diff -r 82d254b8f01e -r e377590e9b19 pandoc.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pandoc.lua Mon Apr 20 11:48:40 2020 -0500 @@ -0,0 +1,21 @@ +local pandoc={} + +local io = require('io') +local os = require('os') + +function pandoc.pandoc(str) + -- Lua doesn't have bidirectional pipes without the posix library. + -- Keep things and compatible and use temporary files. + tmpname = os.tmpname() + file = io.open(tmpname, 'w') + file:write(str) + cmd = 'pandoc --from=markdown --to=html "' .. tmpname .. '"' + io.stdout:write('Executing ' .. cmd .. '\n') + h = io.popen(cmd, 'r') + result = h:read("*a") + h:close() + file:close() + return result +end + +return pandoc