Improve markdown output from finddesc.lua

* It didn't add spaces after the ## or #, which made them not work as headings in some renderers, so I fixed this.
* I then made it add newlines to make it look nicer without being rendered.
This commit is contained in:
Skye M 2020-05-12 01:49:51 +01:00
parent daa2975fd6
commit e09650276a

View File

@ -12,14 +12,14 @@ for _,file in pairs(tA) do
for k,v in pairs(lines) do for k,v in pairs(lines) do
local name, args, desc = v:match("function%s+(.+)%s*%((.*)%)%s*%-%-%s*(.+)") local name, args, desc = v:match("function%s+(.+)%s*%((.*)%)%s*%-%-%s*(.+)")
if name and args and desc then if name and args and desc then
docfiles[file][#docfiles[file]+1] = string.format("##%s(%s)\n%s",name,args,desc) docfiles[file][#docfiles[file]+1] = string.format("## %s(%s)\n%s\n",name,args,desc)
end end
end end
end end
for k,v in pairs(docfiles) do for k,v in pairs(docfiles) do
if #v > 0 then if #v > 0 then
print("#"..k) print("\n# "..k)
for l,m in pairs(v) do for l,m in pairs(v) do
print(m) print(m)
end end