From 46c86351a0dd1c8a6a6281df232e8abc574d629e Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sat, 23 Nov 2019 13:58:47 +0100 Subject: [PATCH] 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`. --- docs/common/widget.ldoc | 4 ++-- docs/config.ld | 6 +++--- docs/ldoc.css | 20 ++++++++++++++++++++ docs/ldoc.ltp | 11 ++++++++--- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/docs/common/widget.ldoc b/docs/common/widget.ldoc index b2a3b0eee..2587c0420 100644 --- a/docs/common/widget.ldoc +++ b/docs/common/widget.ldoc @@ -59,7 +59,7 @@ --- Add a new `awful.button` to this widget. -- @tparam awful.button button The button to add. --- @function add_button +-- @method add_button -- @baseclass wibox.widget --- Emit a signal and ensure all parent widgets in the hierarchies also @@ -67,8 +67,8 @@ -- set of containers and layouts wrapping the widget. -- @tparam string signal_name -- @param ... Other arguments --- @method emit_signal_recursive -- @baseclass wibox.widget +-- @method emit_signal_recursive --- When the layout (size) change. -- This signal is emitted when the previous results of `:layout()` and `:fit()` diff --git a/docs/config.ld b/docs/config.ld index 2920a6828..94e170bf4 100644 --- a/docs/config.ld +++ b/docs/config.ld @@ -591,7 +591,6 @@ local function wrap_args(item) return " ("..new_args..")" end - -- Mimics the ldoc built-in method style, but better. -- -- This custom renderer exists because using ldoc built-in method detection @@ -638,7 +637,9 @@ local function sanitize_type(item, ldoc) item.display_type = "N/A" end local no_prefix = { - property = true, signal = true, clientruleproperty = true, + property = true, + signal = true, + clientruleproperty = true, deprecatedproperty = true, } @@ -733,7 +734,6 @@ custom_display_name_handler = function(item, default_handler) ret = render_methods(item) end - -- Get rid of the "module:" in front of method names. It is either wrong or -- just redundant. ret = ret:gsub("([^:]*)(:[^:])","%2") diff --git a/docs/ldoc.css b/docs/ldoc.css index 04aa7ae88..b85cf6a68 100644 --- a/docs/ldoc.css +++ b/docs/ldoc.css @@ -282,6 +282,7 @@ table.module_list td, table.function_list td { table.module_list td.name, table.function_list td.name { background-color: white; min-width: 200px; + border-left-width: 0px; border-right-width: 0px; } 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 { background-color: white; + border-left-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 { padding-right: 20px; float: right; } +span.inheritance { + color: #9db9f3; + font-weight: normal; +} + td.summarytype { background-color: white; color: #a4c7ff; @@ -402,6 +417,11 @@ ul.nowrap { font-weight: normal; } +/*.inheritedmethodparent { + color: #9db9f3; + font-weight: normal; +}*/ + /* stop sublists from having initial vertical space */ ul ul { margin-top: 0px; } ol ul { margin-top: 0px; } diff --git a/docs/ldoc.ltp b/docs/ldoc.ltp index ea1b4a7e4..bab49c9e0 100644 --- a/docs/ldoc.ltp +++ b/docs/ldoc.ltp @@ -161,12 +161,12 @@ # else $(dn) # end - $(M(item.summary,item)) - + $(M(item.summary,item)) # if item.inherited then + Inherited from $(item.baseclass) -# end +# end # end -- for items # last_kind = kind @@ -210,6 +210,11 @@
$(display_name(item)) +# if item.display_inheritance then + + · Inherited from + $(item.display_inheritance) +# end # if item.display_type then ($(item.display_type)) # end