Write Pandoc lua-filter in MoonScript and compile to Lua on build
This commit is contained in:
11
site.moon
11
site.moon
@@ -13,6 +13,9 @@ import p from require "moon" -- debug
|
||||
-- Change output dir to what Openresty prefers
|
||||
Site.config.out_dir = "html/"
|
||||
|
||||
-- Compile lua-filter used by Pandoc to highlight MoonScript syntax
|
||||
os.execute "moonc pygments.moon"
|
||||
|
||||
-- Configure the command our custom renderer uses to convert markdown to html
|
||||
rend = "renderers.markdown"
|
||||
require(rend).cmd = "pandoc --mathjax --lua-filter pygments.lua >"
|
||||
@@ -120,13 +123,13 @@ sitegen.create =>
|
||||
add "blog.html", title: "Posts", target: "posts/index", template: "blog"
|
||||
add_all files_from "docs"
|
||||
|
||||
copy "app.css"
|
||||
copy "moonscript.css"
|
||||
copy "pygments.css"
|
||||
|
||||
-- replace post markdown yaml headers with moonscript headers
|
||||
filter "docs", (body) =>
|
||||
body\gsub "^%-%-%-.-%.%.%.", (yaml_header) ->
|
||||
header = yaml_header\gsub "%-%-%-", "{"
|
||||
moonscript_header = header\gsub "%.%.%.", "}"
|
||||
moonscript_header
|
||||
|
||||
copy "app.css"
|
||||
copy "moonscript.css"
|
||||
copy "pygments.css"
|
||||
|
||||
Reference in New Issue
Block a user