miti.sh/pygments.lua

16 lines
443 B
Lua

return {
CodeBlock = function(block)
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")
return pandoc.RawBlock("html", out)
end
end
}