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
|
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
|
RUN luarocks install sitegen
|
||||||
|
|
||||||
CMD ["sh", "-c", "openresty -p `pwd` -g 'daemon off;'"]
|
CMD ["sh", "-c", "openresty -p `pwd` -g 'daemon off;'"]
|
||||||
|
@ -53,8 +53,6 @@
|
|||||||
|
|
||||||
## todo
|
## todo
|
||||||
|
|
||||||
current problem: why does sitegen wrap every thing in <p> tags?
|
|
||||||
|
|
||||||
* treesitter highlighting for moonscript
|
* treesitter highlighting for moonscript
|
||||||
* penlight library
|
* penlight library
|
||||||
* sitegen plugins
|
* sitegen plugins
|
||||||
|
@ -76,39 +76,18 @@ class MarkdownRenderer extends require "sitegen.renderers.html"
|
|||||||
ext: "html"
|
ext: "html"
|
||||||
|
|
||||||
render: (page, md_source) =>
|
render: (page, md_source) =>
|
||||||
discount = require "discount"
|
-- discount = require "discount"
|
||||||
|
|
||||||
md_source = page\pipe "renderer.markdown.pre_render", md_source
|
md_source = page\pipe "renderer.markdown.pre_render", md_source
|
||||||
md_source, escapes = escape_cosmo md_source
|
md_source, escapes = escape_cosmo md_source
|
||||||
|
|
||||||
-- require("moon").p md_source
|
markup_filename = os.tmpname!
|
||||||
--mathjax --output=../priv/static/posts/#{output_file}.html
|
input_handle = io.popen "pandoc > #{markup_filename}", "w"
|
||||||
-- handle = io.popen "pandoc"
|
input_handle\write md_source
|
||||||
-- handle\write "# hello"
|
input_handle\close!
|
||||||
-- handle\flush!
|
|
||||||
-- result = handle\read("*a")
|
|
||||||
-- print result
|
|
||||||
-- handle\close!
|
|
||||||
|
|
||||||
-- require("moon").p result
|
output_handle = io.open markup_filename, "r"
|
||||||
|
result = output_handle\read "*a"
|
||||||
-- txt = "# hello"
|
output_handle\close!
|
||||||
-- 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!
|
|
||||||
|
|
||||||
html_source = assert result
|
html_source = assert result
|
||||||
-- html_source = assert discount md_source
|
-- 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"
|
format_date = (str) -> date(str)\fmt "%b %d, %Y"
|
||||||
publish_date = (path) -> format_date extract_date path
|
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 =>
|
sitegen.create =>
|
||||||
@site_title = "WebDevCat.me · Catalin Mititiuc"
|
@site_title = "WebDevCat.me · Catalin Mititiuc"
|
||||||
@app_name = "stasis"
|
@app_name = "stasis"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user