From 89854e153731af4a6cb1c6178433846266d62bf4 Mon Sep 17 00:00:00 2001 From: abadc0de Date: Wed, 27 Nov 2013 19:47:44 -0500 Subject: [PATCH] Custom tags Custom tags --- ldoc.lua | 12 +++++++++++- ldoc/html/ldoc_ltp.lua | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ldoc.lua b/ldoc.lua index 31db3c4..a46bcb2 100644 --- a/ldoc.lua +++ b/ldoc.lua @@ -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] diff --git a/ldoc/html/ldoc_ltp.lua b/ldoc/html/ldoc_ltp.lua index e173fa4..07ddadb 100644 --- a/ldoc/html/ldoc_ltp.lua +++ b/ldoc/html/ldoc_ltp.lua @@ -148,6 +148,21 @@ return [==[
$(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) +

$(custom.title or custom[1]):

+ +# end -- iter tags +# end # if show_parms and item.params and #item.params > 0 then # local subnames = module.kinds:type_of(item).subnames