Fix markdown compile command; deactivate pygments plugin; replace yaml

header with moonscript header
This commit is contained in:
Catalin Constantin Mititiuc 2025-06-16 20:18:04 -07:00
parent 24ff99a954
commit 390bae125c

View File

@ -10,6 +10,10 @@ path = require "sitegen.path"
-- Change output dir to what Openresty prefers -- Change output dir to what Openresty prefers
site.config.out_dir = "html/" site.config.out_dir = "html/"
-- Deactivate "pygments" plugin
site.default_plugins = for v in *site.default_plugins
if v\find "pygments" then continue else v
rootname = (str) -> rootname = (str) ->
result = string.gsub str, "%..+", "" result = string.gsub str, "%..+", ""
result result
@ -31,7 +35,7 @@ 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
-- monkey-patch sitegen to use pandoc for markdown conversion -- monkey-patch sitegen to use pandoc for markdown conversion
os.execute "moonc -t \ os.execute "moonc -t \\
/usr/local/openresty/luajit/share/lua/5.1/sitegen/renderers/ markdown.moon" /usr/local/openresty/luajit/share/lua/5.1/sitegen/renderers/ markdown.moon"
sitegen.create => sitegen.create =>
@ -39,11 +43,24 @@ sitegen.create =>
@app_name = "stasis" @app_name = "stasis"
@version = "0.2.12" @version = "0.2.12"
-- add "test.md"
--
-- filter "test", (body) =>
-- body\gsub "%-%-%-.-%.%.%.", (yaml_header) ->
-- moonscript_header = yaml_header\gsub "%-%-%-", "{"
-- result = moonscript_header\gsub "%.%.%.", "}"
-- result
add "index.html" add "index.html"
add path, target: out, template: "blog", is_a: "post", post: { add path, target: out, template: "blog", is_a: "post", post: {
publish_date: publish_date(path) publish_date: publish_date(path)
}, id: extract_id(path) for path, out in pairs posts "docs" }, id: extract_id(path) for path, out in pairs posts "docs"
filter "docs", (body) =>
body\gsub "%-%-%-.-%.%.%.", (yaml_header) ->
moonscript_header = yaml_header\gsub "%-%-%-", "{"
result = moonscript_header\gsub "%.%.%.", "}"
result
-- add "docs/2023-11-15-test-mix-task-file-modify.md", -- add "docs/2023-11-15-test-mix-task-file-modify.md",
-- target: "posts/2023-11-15-test-mix-task-file-modify.html" -- target: "posts/2023-11-15-test-mix-task-file-modify.html"
-- template: "blog" -- template: "blog"
@ -55,10 +72,11 @@ sitegen.create =>
copy "app.css" copy "app.css"
-- filter "docs", (body) => -- filter "test", (body) =>
-- require("moon").p body -- require("moon").p body
-- filter "2023%-08%-03", (body) => -- filter "2023%-08%-03", (body) =>
-- print "hello"
-- table.concat { body, "<p>hey there</p>" } -- table.concat { body, "<p>hey there</p>" }
-- --
-- body\gsub "<h1>.-</h1>", (header) -> -- body\gsub "<h1>.-</h1>", (header) ->