Refactor markdown.moon; add pandoc to Dockerfile; monkey-patch sitegen
markdown renderer
This commit is contained in:
parent
1a84bef4d9
commit
5fc1dbe771
@ -2,7 +2,7 @@ FROM openresty/openresty:1.27.1.2-0-bookworm-buildpack
|
||||
|
||||
WORKDIR /opt/app
|
||||
|
||||
RUN apt-get update && apt-get install -y python3-pygments
|
||||
RUN apt-get update && apt-get install -y python3-pygments pandoc
|
||||
RUN luarocks install sitegen
|
||||
|
||||
CMD ["sh", "-c", "openresty -p `pwd` -g 'daemon off;'"]
|
||||
|
@ -53,8 +53,6 @@
|
||||
|
||||
## todo
|
||||
|
||||
current problem: why does sitegen wrap every thing in <p> tags?
|
||||
|
||||
* treesitter highlighting for moonscript
|
||||
* penlight library
|
||||
* sitegen plugins
|
||||
|
@ -76,39 +76,18 @@ class MarkdownRenderer extends require "sitegen.renderers.html"
|
||||
ext: "html"
|
||||
|
||||
render: (page, md_source) =>
|
||||
discount = require "discount"
|
||||
|
||||
-- discount = require "discount"
|
||||
md_source = page\pipe "renderer.markdown.pre_render", md_source
|
||||
md_source, escapes = escape_cosmo md_source
|
||||
|
||||
-- require("moon").p md_source
|
||||
--mathjax --output=../priv/static/posts/#{output_file}.html
|
||||
-- handle = io.popen "pandoc"
|
||||
-- handle\write "# hello"
|
||||
-- handle\flush!
|
||||
-- result = handle\read("*a")
|
||||
-- print result
|
||||
-- handle\close!
|
||||
markup_filename = os.tmpname!
|
||||
input_handle = io.popen "pandoc > #{markup_filename}", "w"
|
||||
input_handle\write md_source
|
||||
input_handle\close!
|
||||
|
||||
-- require("moon").p result
|
||||
|
||||
-- txt = "# hello"
|
||||
-- md = "<<EOF\n#{md_source}\nEOF"
|
||||
-- require("moon").p md
|
||||
-- n = os.tmpname!
|
||||
-- handle = io.popen "pandoc > " .. n, "w"
|
||||
-- handle\write "# hello"
|
||||
-- result = handle\read("*a")
|
||||
-- handle\close!
|
||||
|
||||
n = os.tmpname!
|
||||
handle = io.popen "pandoc > " .. n, "w"
|
||||
handle\write md_source
|
||||
handle\close!
|
||||
|
||||
f = io.open n, "r"
|
||||
result = f\read("*a")
|
||||
f\close!
|
||||
output_handle = io.open markup_filename, "r"
|
||||
result = output_handle\read "*a"
|
||||
output_handle\close!
|
||||
|
||||
html_source = assert result
|
||||
-- html_source = assert discount md_source
|
||||
|
@ -73,6 +73,10 @@ extract_date = (source) -> string.match path.filename(source), "%d+%-%d%d%-%d%d"
|
||||
format_date = (str) -> date(str)\fmt "%b %d, %Y"
|
||||
publish_date = (path) -> format_date extract_date path
|
||||
|
||||
os.execute [[
|
||||
moonc -t /usr/local/openresty/luajit/share/lua/5.1/sitegen/renderers/ markdown.moon
|
||||
]]
|
||||
|
||||
sitegen.create =>
|
||||
@site_title = "WebDevCat.me · Catalin Mititiuc"
|
||||
@app_name = "stasis"
|
||||
|
Loading…
x
Reference in New Issue
Block a user