mirror of https://github.com/Hilbis/Hilbish
fix(commands/doc): strip html in headings
parent
1226801a78
commit
b594c4c30b
|
@ -10,6 +10,16 @@ commander.register('doc', function(args)
|
||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
local modules = table.map(fs.readdir(moddocPath), function(f)
|
||||||
|
return lunacolors.underline(lunacolors.blue(string.gsub(f, '.md', '')))
|
||||||
|
end)
|
||||||
|
local doc = [[
|
||||||
|
Welcome to Hilbish's documentation viewer! Here you can find
|
||||||
|
documentation for builtin functions and other things related
|
||||||
|
to Hilbish.
|
||||||
|
|
||||||
|
Usage: doc <section> [subdoc]
|
||||||
|
Available sections: ]] .. table.concat(modules, ', ')
|
||||||
if #args > 0 then
|
if #args > 0 then
|
||||||
local mod = args[1]
|
local mod = args[1]
|
||||||
|
|
||||||
|
@ -63,35 +73,20 @@ commander.register('doc', function(args)
|
||||||
if mod == 'api' then
|
if mod == 'api' then
|
||||||
funcdocs = string.format(apidocHeader, vals.title, vals.description or 'no description.') .. funcdocs
|
funcdocs = string.format(apidocHeader, vals.title, vals.description or 'no description.') .. funcdocs
|
||||||
end
|
end
|
||||||
local backtickOccurence = 0
|
doc = funcdocs:sub(1, #funcdocs - 1)
|
||||||
local formattedFuncs = lunacolors.format(funcdocs:sub(1, #funcdocs - 1):gsub('`', function()
|
|
||||||
backtickOccurence = backtickOccurence + 1
|
|
||||||
if backtickOccurence % 2 == 0 then
|
|
||||||
return '{reset}'
|
|
||||||
else
|
|
||||||
return '{underline}{green}'
|
|
||||||
end
|
|
||||||
end):gsub('#+.-\n', function(t)
|
|
||||||
return '{bold}{magenta}' .. t .. '{reset}'
|
|
||||||
end))
|
|
||||||
print(formattedFuncs)
|
|
||||||
f:close()
|
f:close()
|
||||||
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
local modules = table.map(fs.readdir(moddocPath), function(f)
|
|
||||||
return lunacolors.underline(lunacolors.blue(string.gsub(f, '.md', '')))
|
|
||||||
end)
|
|
||||||
|
|
||||||
io.write [[
|
local backtickOccurence = 0
|
||||||
Welcome to Hilbish's doc tool! Here you can find documentation for builtin
|
print(lunacolors.format(doc:gsub('`', function()
|
||||||
functions and other things.
|
backtickOccurence = backtickOccurence + 1
|
||||||
|
if backtickOccurence % 2 == 0 then
|
||||||
Usage: doc <section> [subdoc]
|
return '{reset}'
|
||||||
A section is a module or a literal section and a subdoc is a subsection for it.
|
else
|
||||||
|
return '{underline}{green}'
|
||||||
Available sections: ]]
|
end
|
||||||
io.flush()
|
end):gsub('#+.-\n', function(t)
|
||||||
|
local signature = t:gsub('<.->(.-)</.->', '{underline}%1'):gsub('\\', '<')
|
||||||
print(table.concat(modules, ', '))
|
return '{bold}{yellow}' .. signature .. '{reset}'
|
||||||
|
end)))
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in New Issue