computable-pandoc/scripts/make_jsons.lua

25 lines
580 B
Lua

-- Makes JSON test files
-- Adds Lua custom extensions
require "src.extensions"
-- Variables
local filter = "dist/lin.lua"
-- Gets command according to OS
local function getcmd(str)
local system = (os.isunix() and "unix" or "win")
if os:isunix() then
return "ls"
else
return "dir"
end
end
-- Makes JSON from markup files
for file in io.popen(getcmd("ls") .. " tests/asts"):lines() do
local json = pandoc.path.join({"tests", "asts", file})
local mark = pandoc.path.join({"tests", pandoc.path.filename(json:stem())})
pandoc.convert(mark, "json", json)
end