aboutsummaryrefslogtreecommitdiff
path: root/tools/update-readme.lua
blob: eabaf2285b28691cd33035ba22137c37665c2de6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- update README.md based on MANUAL.txt
-- 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 = {}

function Div(elem)
    local ident = elem.identifier or ""
    local get = function(el)
                    if el.identifier == ident then
                        result = el
                    end
                end
    if ident == 'input-formats' or ident == 'output-formats' then
      pandoc.walk_block(pandoc.Div(mdoc.blocks), { Div = get })
      return result
    end
end