Custom tags

Custom tags
This commit is contained in:
abadc0de 2013-11-27 19:47:44 -05:00
parent 4294b2e2da
commit 89854e1537
2 changed files with 26 additions and 1 deletions

View File

@ -193,7 +193,7 @@ function ldoc.custom_see_handler(pat, handler)
end
local ldoc_contents = {
'alias','add_language_extension','new_type','add_section', 'tparam_alias',
'alias','add_language_extension','custom_tags','new_type','add_section', 'tparam_alias',
'file','project','title','package','format','output','dir','ext', 'topics',
'one','style','template','description','examples', 'pretty', 'charset', 'plain',
'readme','all','manual_url', 'ignore', 'colon', 'sort', 'module_file','vars',
@ -307,6 +307,16 @@ else
args.file = abspath(args.file)
end
if type(ldoc.custom_tags) == 'table' then -- custom tags
for i, custom in ipairs(ldoc.custom_tags) do
if type(custom) == 'string' then
custom = {custom}
ldoc.custom_tags[i] = custom
end
doc.add_tag(custom[1], 'ML')
end
end -- custom tags
local source_dir = args.file
if type(source_dir) == 'table' then
source_dir = source_dir[1]

View File

@ -148,6 +148,21 @@ return [==[
</dt>
<dd>
$(M(ldoc.descript(item),item))
# if ldoc.custom_tags then
# for custom in iter(ldoc.custom_tags) do
# local tag = item.tags[custom[1]]
# if tag then
# local li,il = use_li(tag)
<h3>$(custom.title or custom[1]):</h3>
<ul>
# for value in iter(tag) do
$(li)$(custom.format and custom.format(value) or M(value))$(il)
# end -- for
# end -- if tag
</ul>
# end -- iter tags
# end
# if show_parms and item.params and #item.params > 0 then
# local subnames = module.kinds:type_of(item).subnames