doc: Improve the "See also" section.

Now display:

 * The description summary.
 * The item kind.
 * The module name (if non-local).
This commit is contained in:
Emmanuel Lepage Vallee 2021-12-14 12:14:32 -08:00
parent af3e62ae64
commit 16f84ec87a
2 changed files with 30 additions and 5 deletions

View File

@ -233,6 +233,20 @@ table th, table td {
padding: 2px; padding: 2px;
} }
.see_also, .see_also td {
border-style: hidden !important;
}
.see_also tr td:nth-of-type(1) {
display: list-item;
list-style-type: disc;
list-style-position: inside;
}
.see_also tr:hover {
background-color: #f7fbff;
}
.widget_list td { .widget_list td {
padding-top: 10px; padding-top: 10px;
padding-bottom: 10px; padding-bottom: 10px;

View File

@ -35,6 +35,7 @@
# local nowrap = ldoc.wrap and '' or 'nowrap' # local nowrap = ldoc.wrap and '' or 'nowrap'
# local html_space = function(s) return s:gsub(" ", "%%20") end # local html_space = function(s) return s:gsub(" ", "%%20") end
# local no_underscores = function(s) return s:gsub("_", " ") end # local no_underscores = function(s) return s:gsub("_", " ") end
# local get_item = function(mod, name) for item in iter(mod.items) do if item.name == name then return item end end; return name == "" and mod or nil end
# --------- modules hierarchy ------------- # --------- modules hierarchy -------------
# local hierarchy = {} # local hierarchy = {}
@ -247,7 +248,7 @@
<h3>See also:</h3> <h3>See also:</h3>
<$(list_or_p)> <$(list_or_p)>
# for see in iter(module.see) do # for see in iter(module.see) do
$(li)<a href="$(ldoc.href(see))">$(see.label)</a>$(il) $(li)<a href="$(ldoc.href(see))">$(see.label) BOB</a>$(il)
# end -- for # end -- for
</$(list_or_p)> </$(list_or_p)>
</div> </div>
@ -438,11 +439,21 @@
# if item.see then # if item.see then
# local li,il = use_li(item.see) # local li,il = use_li(item.see)
<h3>See also:</h3> <h3>See also:</h3>
<ul> <table class="see_also">
# for see in iter(item.see) do # for see in iter(item.see) do
$(li)<a href="$(ldoc.href(see))">$(see.label)</a>$(il) # local see_item = see.mod and get_item(see.mod, see.name)
# local see_mod = (see_item and see.mod and see.mod ~= item.module and see.mod.name ~= see_item.name) and "("..see.mod.name..")" or ""
<tr>
<td><a href="$(ldoc.href(see))" title="In the $(see.mod and see.mod.name) module.">$(see.label)</a></td>
<td>$(see_item and M(see_item.summary)) $(see_mod)</td>
<td>
# if see_item or see.name == "" then
<span class="chips">$(see.name == "" and "module" or (see_item and see_item.kind))</span>
# end
</td>
<tr>
# end -- for # end -- for
</ul> </table>
# end -- if see # end -- if see
# if item.usage then # if item.usage then