Updated ldoc_ltp.lua

Various fixes to make the template generate valid xhtml.
This commit is contained in:
John Erling Blad 2019-05-12 22:39:41 +02:00 committed by GitHub
parent f91c3182cf
commit 3a2b47ecfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 7 deletions

View File

@ -1,9 +1,9 @@
return [==[ return [==[
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html> <html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=$(ldoc.doc_charset)"/>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=$(ldoc.doc_charset)"/>
<title>$(ldoc.title)</title> <title>$(ldoc.title)</title>
<link rel="stylesheet" href="$(ldoc.css)" type="text/css" /> <link rel="stylesheet" href="$(ldoc.css)" type="text/css" />
# if ldoc.custom_css then -- add custom CSS file if configured. # if ldoc.custom_css then -- add custom CSS file if configured.
@ -68,7 +68,7 @@ return [==[
# for kind, mods, type in ldoc.kinds() do # for kind, mods, type in ldoc.kinds() do
# if ldoc.allowed_in_contents(type,module) then # if ldoc.allowed_in_contents(type,module) then
<h2>$(kind)</h2> <h2>$(kind)</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap')"> <ul class="$(kind=='Topics' and '' or nowrap)">
# for mod in mods() do local name = display_name(mod) # for mod in mods() do local name = display_name(mod)
# if mod.name == this_mod then # if mod.name == this_mod then
<li><strong>$(name)</strong></li> <li><strong>$(name)</strong></li>
@ -128,7 +128,7 @@ return [==[
<table class="function_list"> <table class="function_list">
# for item in items() do # for item in items() do
<tr> <tr>
<td class="name" $(nowrap)><a href="#$(item.name)">$(display_name(item))</a></td> <td class="name $(nowrap)"><a href="#$(item.name)">$(display_name(item))</a></td>
<td class="summary">$(M(item.summary,item))</td> <td class="summary">$(M(item.summary,item))</td>
</tr> </tr>
# end -- for items # end -- for items
@ -182,8 +182,8 @@ return [==[
# for value in iter(tag) do # for value in iter(tag) do
$(li)$(custom.format and custom.format(value) or M(value))$(il) $(li)$(custom.format and custom.format(value) or M(value))$(il)
# end -- for # end -- for
</ul "@todo">
# end -- if tag # end -- if tag
</ul>
# end -- iter tags # end -- iter tags
# end # end
@ -217,7 +217,8 @@ return [==[
</li> </li>
# end # end
# if sublist then # if sublist then
</li></ul> </ul>
</li>
# end # end
# end -- for # end -- for
</ul> </ul>
@ -226,7 +227,9 @@ return [==[
# if show_return and item.retgroups then local groups = item.retgroups # if show_return and item.retgroups then local groups = item.retgroups
<h3>Returns:</h3> <h3>Returns:</h3>
# for i,group in ldoc.ipairs(groups) do local li,il = use_li(group) # for i,group in ldoc.ipairs(groups) do local li,il = use_li(group)
# if #group > 1 then
<ol> <ol>
# end
# for r in group:iter() do local type, ctypes = item:return_type(r); local rt = ldoc.typename(type) # for r in group:iter() do local type, ctypes = item:return_type(r); local rt = ldoc.typename(type)
$(li) $(li)
# if rt ~= '' then # if rt ~= '' then
@ -243,7 +246,9 @@ return [==[
</ul> </ul>
# end -- if ctypes # end -- if ctypes
# end -- for r # end -- for r
# if #group > 1 then
</ol> </ol>
# end
# if i < #groups then # if i < #groups then
<h3>Or</h3> <h3>Or</h3>
# end # end
@ -295,7 +300,7 @@ return [==[
<table class="module_list"> <table class="module_list">
# for m in mods() do # for m in mods() do
<tr> <tr>
<td class="name" $(nowrap)><a href="$(no_spaces(kind))/$(m.name).html">$(m.name)</a></td> <td class="name $(nowrap)"><a href="$(no_spaces(kind))/$(m.name).html">$(m.name)</a></td>
<td class="summary">$(M(ldoc.strip_header(m.summary),m))</td> <td class="summary">$(M(ldoc.strip_header(m.summary),m))</td>
</tr> </tr>
# end -- for modules # end -- for modules