Add ldoc tags for inherited members.

* Add `@inheritedproperty`, `@inheritedmethod` and `@inheritedsignal` ldoc tags to specify inherited members in the documentation,
* These new tags create their own section in the rendered documentation,
* Implemente these tags for `docs/common/object.ldoc` and `docs/common/widget.ldoc`.
This commit is contained in:
Aire-One 2019-11-23 13:58:47 +01:00 committed by Emmanuel Lepage Vallee
parent a0386dad91
commit 46c86351a0
4 changed files with 33 additions and 8 deletions

View File

@ -59,7 +59,7 @@
--- Add a new `awful.button` to this widget. --- Add a new `awful.button` to this widget.
-- @tparam awful.button button The button to add. -- @tparam awful.button button The button to add.
-- @function add_button -- @method add_button
-- @baseclass wibox.widget -- @baseclass wibox.widget
--- Emit a signal and ensure all parent widgets in the hierarchies also --- Emit a signal and ensure all parent widgets in the hierarchies also
@ -67,8 +67,8 @@
-- set of containers and layouts wrapping the widget. -- set of containers and layouts wrapping the widget.
-- @tparam string signal_name -- @tparam string signal_name
-- @param ... Other arguments -- @param ... Other arguments
-- @method emit_signal_recursive
-- @baseclass wibox.widget -- @baseclass wibox.widget
-- @method emit_signal_recursive
--- When the layout (size) change. --- When the layout (size) change.
-- This signal is emitted when the previous results of `:layout()` and `:fit()` -- This signal is emitted when the previous results of `:layout()` and `:fit()`

View File

@ -591,7 +591,6 @@ local function wrap_args(item)
return "<span class='function_args'> <b>(</b>"..new_args.."<b>)</b></span>" return "<span class='function_args'> <b>(</b>"..new_args.."<b>)</b></span>"
end end
-- Mimics the ldoc built-in method style, but better. -- Mimics the ldoc built-in method style, but better.
-- --
-- This custom renderer exists because using ldoc built-in method detection -- This custom renderer exists because using ldoc built-in method detection
@ -638,7 +637,9 @@ local function sanitize_type(item, ldoc)
item.display_type = "<span class='summary_type'>N/A</span>" item.display_type = "<span class='summary_type'>N/A</span>"
end end
local no_prefix = { local no_prefix = {
property = true, signal = true, clientruleproperty = true, property = true,
signal = true,
clientruleproperty = true,
deprecatedproperty = true, deprecatedproperty = true,
} }
@ -733,7 +734,6 @@ custom_display_name_handler = function(item, default_handler)
ret = render_methods(item) ret = render_methods(item)
end end
-- Get rid of the "module:" in front of method names. It is either wrong or -- Get rid of the "module:" in front of method names. It is either wrong or
-- just redundant. -- just redundant.
ret = ret:gsub("([^:]*)(:[^:])","%2") ret = ret:gsub("([^:]*)(:[^:])","%2")

View File

@ -282,6 +282,7 @@ table.module_list td, table.function_list td {
table.module_list td.name, table.function_list td.name { table.module_list td.name, table.function_list td.name {
background-color: white; background-color: white;
min-width: 200px; min-width: 200px;
border-left-width: 0px;
border-right-width: 0px; border-right-width: 0px;
} }
table.module_list td.summary, table.function_list td.summary { table.module_list td.summary, table.function_list td.summary {
@ -293,14 +294,28 @@ table.module_list td.summary, table.function_list td.summary {
table.function_list td.shortname { table.function_list td.shortname {
background-color: white; background-color: white;
border-left-width: 0px;
border-right-width: 0px; border-right-width: 0px;
} }
table.function_list td.inheritance {
background-color: white;
border-right-width: 0px;
border-left-width: 0px;
color: #a4c7ff;
min-width: 200px;
}
.proptype { .proptype {
padding-right: 20px; padding-right: 20px;
float: right; float: right;
} }
span.inheritance {
color: #9db9f3;
font-weight: normal;
}
td.summarytype { td.summarytype {
background-color: white; background-color: white;
color: #a4c7ff; color: #a4c7ff;
@ -402,6 +417,11 @@ ul.nowrap {
font-weight: normal; font-weight: normal;
} }
/*.inheritedmethodparent {
color: #9db9f3;
font-weight: normal;
}*/
/* stop sublists from having initial vertical space */ /* stop sublists from having initial vertical space */
ul ul { margin-top: 0px; } ul ul { margin-top: 0px; }
ol ul { margin-top: 0px; } ol ul { margin-top: 0px; }

View File

@ -161,12 +161,12 @@
# else # else
<td class="name" $(nowrap)><a href="#$(item.name)">$(dn)</a></td> <td class="name" $(nowrap)><a href="#$(item.name)">$(dn)</a></td>
# end # end
<td class="summary">$(M(item.summary,item))</td> <td colspan="$(item.inherited and 1 or 2)" class="summary">$(M(item.summary,item))</td>
<td class="baseclass" $(nowrap)>
# if item.inherited then # if item.inherited then
<td class="baseclass" $(nowrap)>
Inherited from $(item.baseclass) Inherited from $(item.baseclass)
# end
</td> </td>
# end
</tr> </tr>
# end -- for items # end -- for items
# last_kind = kind # last_kind = kind
@ -210,6 +210,11 @@
<dt> <dt>
<a name = "$(item.name)"></a> <a name = "$(item.name)"></a>
<strong>$(display_name(item))</strong> <strong>$(display_name(item))</strong>
# if item.display_inheritance then
<span class="inheritance">
&middot Inherited from
<a href="$(item.display_inheritance)">$(item.display_inheritance)</a>
# end
# if item.display_type then # if item.display_type then
<span class="proptype">($(item.display_type))</span> <span class="proptype">($(item.display_type))</span>
# end # end