diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2017-12-01 17:14:28 +0100 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2017-12-01 17:14:28 +0100 |
commit | 5026dfaedf4a8043fd1d76c1b7da8880770f9255 (patch) | |
tree | b05627dbe49312c41961b2b350248b7e9981784e /tools | |
parent | 8473a151c5685f8ceb515abf6000ab4fb7a3911c (diff) | |
download | pandoc-5026dfaedf4a8043fd1d76c1b7da8880770f9255.tar.gz |
lua-filters.md: add documentation for pandoc.List
Diffstat (limited to 'tools')
-rw-r--r-- | tools/update-lua-docs.lua | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/tools/update-lua-docs.lua b/tools/update-lua-docs.lua index 223ba3722..daa685269 100644 --- a/tools/update-lua-docs.lua +++ b/tools/update-lua-docs.lua @@ -1,14 +1,26 @@ 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 +-- Generate tmp folder +local tmp_folder = os.tmpname() +os.remove(tmp_folder) +os.execute("mkdir -p " .. tmp_folder) + +function extend(list1, list2) + for i = 1, #list2 do + list1[#list1 + 1] = list2[i] + end +end + +function module_blocks(module_filenames) + local blocks = {} + for _, filename in pairs(module_filenames) do + os.execute("ldoc -q -l tools -d " .. tmp_folder .. " " .. filename) + local module_file = io.open(tmp_folder .. "/index.html") + local module_html = module_file:read("*a") + local module_doc = pandoc.read(module_html, "html") + extend(blocks, module_doc.blocks) + end + return blocks end function Header (el) @@ -21,7 +33,10 @@ function Header (el) end elseif el.identifier == "module-pandoc" then in_module_section = true - return pandoc_module_blocks() + return module_blocks{'data/pandoc.lua'} + elseif el.identifier == "module-pandoc.list" then + in_module_section = true + return module_blocks{'data/List.lua'} end end |