fallback for type macros in tables (starting). Use label suggested by custom lookup for type names

This commit is contained in:
steve donovan 2012-12-13 15:01:33 +02:00
parent f4b164f24f
commit a551b47085
2 changed files with 8 additions and 1 deletions

View File

@ -442,6 +442,7 @@ function Item:finish()
if tags.see then if tags.see then
tags.see = tools.expand_comma_list(read_del(tags,'see')) tags.see = tools.expand_comma_list(read_del(tags,'see'))
end end
local fallback
if doc.project_level(self.type) then if doc.project_level(self.type) then
-- we are a module, so become one! -- we are a module, so become one!
self.items = List() self.items = List()
@ -460,9 +461,14 @@ function Item:finish()
end end
else else
self.parameter = 'field' self.parameter = 'field'
fallback = 'param'
end end
local field = self.parameter local field = self.parameter
local params = read_del(tags,field) local params = read_del(tags,field)
if fallback then
local xparams = read_del(tags,fallback)
params:extend(xparams)
end
local names, comments = List(), List() local names, comments = List(), List()
if params then if params then
for line in params:iter() do 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 for pat, action in pairs(see_reference_handlers) do
if s:match(pat) then if s:match(pat) then
local label, href = action(s:match(pat)) local label, href = action(s:match(pat))
if not label then print('custom rule failed',s,pat,href) end
return {href = href, label = label} return {href = href, label = label}
end end
end end

View File

@ -109,7 +109,7 @@ function html.generate_output(ldoc, args, project)
for name in tp:gmatch("[^|]+") do for name in tp:gmatch("[^|]+") do
local ref,err = markup.process_reference(name) local ref,err = markup.process_reference(name)
if ref then if ref then
types[#types+1] = ('<a class="type" href="%s">%s</a>'):format(ldoc.href(ref),name) types[#types+1] = ('<a class="type" href="%s">%s</a>'):format(ldoc.href(ref),ref.label or name)
else else
types[#types+1] = '<span class="type">'..name..'</span>' types[#types+1] = '<span class="type">'..name..'</span>'
end end