Use classes for formatting argument descriptions rather than tags

This commit is contained in:
Geoff Leyland 2012-10-29 13:26:07 +13:00
parent 9924e4dced
commit 2b304a2252
3 changed files with 17 additions and 4 deletions

View File

@ -109,9 +109,9 @@ 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 href="%s">%s</a> '):format(ldoc.href(ref),name) types[#types+1] = ('<a class="type" href="%s">%s</a>'):format(ldoc.href(ref),name)
else else
types[#types+1] = '<strong>'..name..'</strong> ' types[#types+1] = '<span class="type">'..name..'</span>'
end end
end end
local names = table.concat(types, ", ", 1, math.max(#types-1, 1)) local names = table.concat(types, ", ", 1, math.max(#types-1, 1))

View File

@ -73,6 +73,11 @@ body {
} }
code, tt { font-family: monospace; } code, tt { font-family: monospace; }
span.parameter { font-family:monospace; }
span.parameter:after { content:":"; }
span.types:before { content:"("; }
span.types:after { content:")"; }
.type { font-weight: bold; font-style:italic }
body, p, td, th { font-size: .95em; line-height: 1.2em;} body, p, td, th { font-size: .95em; line-height: 1.2em;}

View File

@ -140,8 +140,12 @@ return [==[
<h3>$(module.kinds:type_of(item).subnames):</h3> <h3>$(module.kinds:type_of(item).subnames):</h3>
<ul> <ul>
# for p in iter(item.params) do # for p in iter(item.params) do
<li><span class="parameter">$(p)</span>
# local tp = ldoc.typename(item:type_of_param(p)) # local tp = ldoc.typename(item:type_of_param(p))
<li><code><em>$(p)</em></code>: $(tp)$(M(item.params[p],item))</li> # if tp ~= '' then
<span class="types">$(tp)</span>
# end
$(M(item.params[p],item))</li>
# end -- for # end -- for
</ul> </ul>
# end -- if params # end -- if params
@ -161,8 +165,12 @@ return [==[
<h3>Returns:</h3> <h3>Returns:</h3>
<ol> <ol>
# for i,r in ldoc.ipairs(item.ret) do # for i,r in ldoc.ipairs(item.ret) do
$(li)
# local tp = ldoc.typename(item:type_of_ret(i)) # local tp = ldoc.typename(item:type_of_ret(i))
$(li)$(tp)$(M(r,item))$(il) # if tp ~= '' then
<span class="types">$(tp)</span>
# end
$(M(r,item))$(il)
# end -- for # end -- for
</ol> </ol>
# end -- if returns # end -- if returns