|
- #!/usr/bin/env lua
- local doc = require "lib/doc"
- local ser = require "lib/serialization"
- local tA = {...}
-
- local outpath = table.remove(tA,1)
-
- print(outpath)
-
- local function formatDocs(fd)
- local rs = ""
- for name,finfo in pairs(fd) do
- if rs:len() > 0 then
- rs = rs .. "\n\n"
- end
- local as = ""
- for k,v in pairs(finfo.args) do
- if k > 1 then
- as = as .. ", "
- end
- as = as .. v[1]
- if v[2] then
- as = as .. "^"..v[2].."^"
- end
- end
- local rt = ""
- for k,v in pairs(finfo.outtypes or {}) do
- if rt:len() > 0 then
- rt = rt .. ", "
- else
- rt = ": "
- end
- rt = rt .. v
- end
- rs = string.format("%s## %s(%s)%s\n%s",rs,name,as,rt,finfo.description)
- end
- return rs
- end
-
- local ad = io.open(outpath,"wb")
-
- for k,v in pairs(tA) do
- local fd = doc.parsefile(v)
- local ds = ser.serialize(fd)
- local tn = v:match("/(.+)$")
- if ds:len() > 3 then
- ad:write(tn.."\t"..ds:gsub("\n",""):gsub(", +",",").."\n")
- end
- end
-
- ad:close()
|