Have CSS classes for section header and description
This commit is contained in:
parent
ec97770051
commit
24a6b27338
|
@ -93,7 +93,7 @@ function html.generate_output(ldoc, args, project)
|
|||
|
||||
-- Item descriptions come from combining the summary and description fields
|
||||
function ldoc.descript(item)
|
||||
return (item.summary or '?')..' '..(item.description or '')
|
||||
return tools.join(' ', item.summary, item.description)
|
||||
end
|
||||
|
||||
function ldoc.module_name (mod)
|
||||
|
|
|
@ -134,10 +134,15 @@ return [==[
|
|||
# local show_parms = show_return
|
||||
# for kind, items in module.kinds() do
|
||||
# local kitem = module.kinds:get_item(kind)
|
||||
<h2><a name="$(no_spaces(kind))"></a>$(kind)</h2>
|
||||
# local has_description = kitem and ldoc.descript(kitem) ~= ""
|
||||
<h2 class="section-header $(has_description and 'has-description')"><a name="$(no_spaces(kind))"></a>$(kind)</h2>
|
||||
$(M(module.kinds:get_section_description(kind),nil))
|
||||
# if kitem then
|
||||
$(M(ldoc.descript(kitem),kitem))
|
||||
# if has_description then
|
||||
<div class="section-description">
|
||||
$(M(ldoc.descript(kitem),kitem))
|
||||
</div>
|
||||
# end
|
||||
# if kitem.usage then
|
||||
<h3>Usage:</h3>
|
||||
<pre class="example">$(ldoc.prettify(kitem.usage[1]))</pre>
|
||||
|
|
|
@ -202,6 +202,27 @@ function M.strip (s)
|
|||
return s:gsub('^%s+',''):gsub('%s+$','')
|
||||
end
|
||||
|
||||
-- Joins strings using a separator.
|
||||
--
|
||||
-- Empty strings and nil arguments are ignored:
|
||||
--
|
||||
-- assert(join('+', 'one', '', 'two', nil, 'three') == 'one+two+three')
|
||||
-- assert(join(' ', '', '') == '')
|
||||
--
|
||||
-- This is especially useful for the last case demonstrated above,
|
||||
-- where "conventional" solutions (".." or table.concat) would result
|
||||
-- in a spurious space.
|
||||
function M.join(sep, ...)
|
||||
local contents = {}
|
||||
for i = 1, select('#', ...) do
|
||||
local value = select(i, ...)
|
||||
if value and value ~= "" then
|
||||
contents[#contents + 1] = value
|
||||
end
|
||||
end
|
||||
return table.concat(contents, sep)
|
||||
end
|
||||
|
||||
function M.check_directory(d)
|
||||
if not path.isdir(d) then
|
||||
lfs.mkdir(d)
|
||||
|
|
Loading…
Reference in New Issue