2017-12-30 01:41:51 +01:00
|
|
|
-- update README.md based on MANUAL.txt
|
2018-04-22 20:36:47 +02:00
|
|
|
-- inserts contents of input-formats and output-formats
|
|
|
|
|
|
|
|
local f = assert(io.open("MANUAL.txt", "r"))
|
|
|
|
local manual = f:read("*all")
|
|
|
|
mdoc = pandoc.read(manual, "markdown")
|
|
|
|
f:close()
|
|
|
|
result = {}
|
2017-12-30 01:41:51 +01:00
|
|
|
|
|
|
|
function Div(elem)
|
2019-12-10 23:46:33 +01:00
|
|
|
local ident = elem.identifier or ""
|
|
|
|
local fixrel = function(el)
|
|
|
|
if el.target:match("^#") then
|
|
|
|
el.target = "https://pandoc.org/MANUAL.html" .. el.target
|
2017-12-30 01:41:51 +01:00
|
|
|
end
|
2019-12-10 23:46:33 +01:00
|
|
|
return el
|
|
|
|
end
|
|
|
|
local get = function(el)
|
|
|
|
if el.identifier == ident then
|
|
|
|
result = pandoc.walk_block(el, { Link = fixrel })
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if ident == 'input-formats' or ident == 'output-formats' then
|
|
|
|
pandoc.walk_block(pandoc.Div(mdoc.blocks), { Div = get })
|
|
|
|
return result
|
|
|
|
end
|
2017-12-30 01:41:51 +01:00
|
|
|
end
|
|
|
|
|