34 lines
893 B
Plaintext
34 lines
893 B
Plaintext
CodeBlock: (block) ->
|
|
fname = os.tmpname!
|
|
with io.open fname, "w"
|
|
\write block.text
|
|
\close!
|
|
|
|
if block.classes[1] == "moon" or block.classes[1] == "moonscript"
|
|
p = io.popen ("pygmentize -f html -l moonscript.py %s -x")\format fname
|
|
|
|
-- p = io.open fname
|
|
out = p\read"*a"
|
|
p\close!
|
|
pandoc.RawBlock "html", out
|
|
-- pandoc.RawBlock "html", "moonscript"
|
|
else
|
|
status, handle_or_error = pcall ->
|
|
io.popen ("pygmentize -f html -l %s %s")\format block.classes[1], fname
|
|
-- io.open fname
|
|
|
|
sout = handle_or_error\read"*a"
|
|
-- handle_or_error\close!
|
|
-- if sout\len! == 0 then block else pandoc.RawBlock "html", sout
|
|
if block.classes[1] == "heex"
|
|
-- pandoc.RawBlock "html", "heex"
|
|
block
|
|
else
|
|
pandoc.RawBlock "html", sout
|
|
|
|
|
|
-- p = io.open fname
|
|
-- out = p\read"*a"
|
|
-- p\close!
|
|
-- pandoc.RawBlock "html", out
|