git.iko.soy/typeable/pandoc
on issue7219 help sign in
typeable/pandoc/tools/update-readme.lua
28 lines 735 B history raw
1-- update README.md based on MANUAL.txt
2-- inserts contents of input-formats and output-formats
4local f = assert(io.open("MANUAL.txt", "r"))
5local manual = f:read("*all")
6mdoc = pandoc.read(manual, "markdown")
7f:close()
8result = {}
10function Div(elem)
11 local ident = elem.identifier or ""
12 local fixrel = function(el)
13 if el.target:match("^#") then
14 el.target = "https://pandoc.org/MANUAL.html" .. el.target
15 end
16 return el
17 end
18 local get = function(el)
19 if el.identifier == ident then
20 result = pandoc.walk_block(el, { Link = fixrel })
21 end
22 end
23 if ident == 'input-formats' or ident == 'output-formats' then
24 pandoc.walk_block(pandoc.Div(mdoc.blocks), { Div = get })
25 return result
26 end
27end