WIP
This commit is contained in:
23
pygments.lua
23
pygments.lua
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user