From a551b47085e7c52bed041049f7fe918395ad473d Mon Sep 17 00:00:00 2001 From: steve donovan Date: Thu, 13 Dec 2012 15:01:33 +0200 Subject: [PATCH] fallback for type macros in tables (starting). Use label suggested by custom lookup for type names --- ldoc/doc.lua | 7 +++++++ ldoc/html.lua | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ldoc/doc.lua b/ldoc/doc.lua index 75534bd..a980c19 100644 --- a/ldoc/doc.lua +++ b/ldoc/doc.lua @@ -442,6 +442,7 @@ function Item:finish() if tags.see then tags.see = tools.expand_comma_list(read_del(tags,'see')) end + local fallback if doc.project_level(self.type) then -- we are a module, so become one! self.items = List() @@ -460,9 +461,14 @@ function Item:finish() end else self.parameter = 'field' + fallback = 'param' end local field = self.parameter local params = read_del(tags,field) + if fallback then + local xparams = read_del(tags,fallback) + params:extend(xparams) + end local names, comments = List(), List() if params then for line in params:iter() do @@ -607,6 +613,7 @@ local function custom_see_references (s) for pat, action in pairs(see_reference_handlers) do if s:match(pat) then local label, href = action(s:match(pat)) + if not label then print('custom rule failed',s,pat,href) end return {href = href, label = label} end end diff --git a/ldoc/html.lua b/ldoc/html.lua index 05c77fa..beee74b 100644 --- a/ldoc/html.lua +++ b/ldoc/html.lua @@ -109,7 +109,7 @@ function html.generate_output(ldoc, args, project) for name in tp:gmatch("[^|]+") do local ref,err = markup.process_reference(name) if ref then - types[#types+1] = ('%s'):format(ldoc.href(ref),name) + types[#types+1] = ('%s'):format(ldoc.href(ref),ref.label or name) else types[#types+1] = ''..name..'' end