diff options
author | Albert Krewinkel <albert+github@zeitkraut.de> | 2017-09-30 16:45:31 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-09-30 10:45:31 -0400 |
commit | c363519302e11daab2187445f39a15ce6ef19137 (patch) | |
tree | 37d22cce642757f913126da96b483c75ac1210f8 /tools | |
parent | 950c68c83562d35bf1f93a213a33f227d1948451 (diff) | |
download | pandoc-c363519302e11daab2187445f39a15ce6ef19137.tar.gz |
Provide make target to update lua module docs (#3946)
The pandoc module documentation in doc/lua-filters.md was automatically
generated from `data/pandoc.lua`. A make target is provided which uses
a lua filter to update the documentation.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/update-lua-docs.lua | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/update-lua-docs.lua b/tools/update-lua-docs.lua new file mode 100644 index 000000000..223ba3722 --- /dev/null +++ b/tools/update-lua-docs.lua @@ -0,0 +1,32 @@ +local in_module_section = false + +function pandoc_module_blocks() + local tmp_folder = os.tmpname() + os.remove(tmp_folder) + os.execute("mkdir -p " .. tmp_folder) + os.execute("ldoc -q -l tools -d " .. tmp_folder .. " data/pandoc.lua") + local module_file = io.open(tmp_folder .. "/index.html") + local module_html = module_file:read("*a") + local module_doc = pandoc.read(module_html, "html") + return module_doc.blocks +end + +function Header (el) + if in_module_section then + if el.level == 1 then + in_module_section = false + return el + else + return {} + end + elseif el.identifier == "module-pandoc" then + in_module_section = true + return pandoc_module_blocks() + end +end + +function Block (el) + if in_module_section then + return {} + end +end |