This commit is contained in:
Catalin Constantin Mititiuc 2025-06-16 20:18:05 -07:00
parent 338b7eb747
commit 09918abe97
2 changed files with 16 additions and 8 deletions

View File

@ -17,10 +17,12 @@ write_exec = (input, cmd, ...) ->
convert = => convert = =>
(md_source) -> (md_source) ->
markup_filename = os.tmpname! filename = os.tmpname!
write_exec md_source, @cmd, markup_filename write_exec md_source, @cmd, filename
Path.read_file markup_filename Path.read_file filename
-- config command like this in site.moon:
-- require("renderers.markdown").cmd = "pandoc --mathjax >"
class PandocRenderer extends require "sitegen.renderers.markdown" class PandocRenderer extends require "sitegen.renderers.markdown"
unescape_cosmo = @unescape_cosmo unescape_cosmo = @unescape_cosmo
escape_cosmo = @escape_cosmo escape_cosmo = @escape_cosmo

View File

@ -6,6 +6,7 @@ date = require "date"
import tag from html import tag from html
import escape_patt from require "sitegen.common" import escape_patt from require "sitegen.common"
import p from require "moon"
-- Change output dir to what Openresty prefers -- Change output dir to what Openresty prefers
Site.config.out_dir = "html/" Site.config.out_dir = "html/"
@ -19,7 +20,9 @@ Site.default_renderers = for v in *Site.default_renderers
if v\find "markdown" then continue else v if v\find "markdown" then continue else v
-- Add pandoc markdown renderer -- Add pandoc markdown renderer
table.insert Site.default_renderers, "renderers.markdown" rend = "renderers.markdown"
require(rend).cmd = "pandoc --mathjax >"
table.insert Site.default_renderers, rend
-- https://github.com/leafo/sitegen/blob/v0.2/spec/sitegen_spec.moon#L9-L18 -- https://github.com/leafo/sitegen/blob/v0.2/spec/sitegen_spec.moon#L9-L18
get_files = (path, prefix=path) -> get_files = (path, prefix=path) ->
@ -59,15 +62,18 @@ list_posts = (page, limit) ->
table.sort posts, (a, b) -> a.source > b.source table.sort posts, (a, b) -> a.source > b.source
html.build -> html.build ->
[tag.section { import section, h3, a, time from tag
tag.h3 { tag.a { href: meta.target .. ".html", meta.title or meta.id }}
tag.time { publish_date source } [section {
h3 { a { href: meta.target .. ".html", meta.title or meta.id }}
time { publish_date source }
{ "—", if meta.blurb then html.builders.text! meta.blurb } { "—", if meta.blurb then html.builders.text! meta.blurb }
tag.a { class: "read-post-link", href: meta.target .. ".html", a { class: "read-post-link", href: meta.target .. ".html",
"Read post →" "Read post →"
} }
} for { meta: meta, source: source } in *posts[1, limit or #posts]] } for { meta: meta, source: source } in *posts[1, limit or #posts]]
sitegen.create => sitegen.create =>
@site_title = "WebDevCat.me · Catalin Mititiuc" @site_title = "WebDevCat.me · Catalin Mititiuc"
@app_name = "stasis" @app_name = "stasis"