Write Pandoc lua-filter in MoonScript and compile to Lua on build
This commit is contained in:
25
pygments.lua
25
pygments.lua
@@ -1,12 +1,15 @@
|
||||
function CodeBlock(block)
|
||||
if block.classes[1] == "moon" or block.classes[1] == "moonscript" then
|
||||
local fname = os.tmpname()
|
||||
local handle = io.open(fname, "w")
|
||||
handle:write(block.text)
|
||||
handle:close()
|
||||
|
||||
local p = io.popen(string.format("pygmentize -f html -l moonscript.py %s -x", fname))
|
||||
local out = p:read("*a")
|
||||
return pandoc.RawBlock("html", out)
|
||||
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
|
||||
end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user