This commit is contained in:
2025-06-16 20:18:05 -07:00
parent 58af575386
commit e041143b27
3 changed files with 48 additions and 15 deletions

View File

@@ -1,15 +1,26 @@
return {
CodeBlock = function(block)
local fname = os.tmpname()
do
local _with_0 = io.open(fname, "w")
_with_0:write(block.text)
_with_0:close()
end
if block.classes[1] == "moon" or block.classes[1] == "moonscript" then
local fname = os.tmpname()
do
local _with_0 = io.open(fname, "w")
_with_0:write(block.text)
_with_0:close()
end
local p = io.popen(("pygmentize -f html -l moonscript.py %s -x"):format(fname))
local out = p:read("*a")
p:close()
return pandoc.RawBlock("html", out)
else
local status, handle_or_error = pcall(function()
return io.popen(("pygmentize -f html -l %s %s"):format(block.classes[1], fname))
end)
local sout = handle_or_error:read("*a")
if block.classes[1] == "heex" then
return block
else
return pandoc.RawBlock("html", sout)
end
end
end
}