diff --git a/docs/config.ld b/docs/config.ld index 63b0ad8e..9b6911d9 100644 --- a/docs/config.ld +++ b/docs/config.ld @@ -456,6 +456,25 @@ add_custom_tag { }, } +-- Define the supermodule class. +-- This tag should be used at the module level. All properties from the +-- supermodule will be recursively added to the module by our ldoc template. +-- @supermodule supermodule +add_custom_tag { + name = "supermodule", + hidden = true, + auto_subtags = false +} + +-- Mark the item ad hidden. +-- This tag should be used to hide items from the documentation. +-- @hidden +add_custom_tag { + name = "hidden", + hidden = true, + auto_subtags = false +} + -- More fitting section names kind_names={topic='Documentation', module='Libraries', script='Sample files'} diff --git a/docs/ldoc.css b/docs/ldoc.css index 1cb5b83b..f429dcdd 100644 --- a/docs/ldoc.css +++ b/docs/ldoc.css @@ -503,3 +503,32 @@ pre .url { color: #272fc2; text-decoration: underline; } .index_guides div a:hover { background-color: #99b3ec; } + +/* Inheritance diagram */ +.inheritance .inheritance__level { + list-style: none; +} + +.inheritance .inheritance__level--root { + padding-left: 0; +} + +.inheritance .inheritance__level__node::before { + content: "↳"; +} + +.inheritance .inheritance__level__node--root::before { + /* simulate the spacing of the arrow character */ + content: " "; + white-space: pre; +} + +.extra-header { + display: flex; + flex-direction: row; + flex-wrap: wrap; +} + +.extra-header__section { + flex-grow: 1; +} diff --git a/docs/ldoc.ltp b/docs/ldoc.ltp index 3c878cc3..06d4587f 100644 --- a/docs/ldoc.ltp +++ b/docs/ldoc.ltp @@ -43,6 +43,80 @@ # local html_space = function(s) return s:gsub(" ", "%%20") end # local no_underscores = function(s) return s:gsub("_", " ") end +# --------- modules hierarchy ------------- +# local hierarchy = {} +# local curr = module +# while curr do +# hierarchy[#hierarchy + 1] = curr +# -- no need to do anything more if there is no explicite @supermodule +# if not curr.tags.supermodule then break end +# local super = curr.tags.supermodule[1] -- only consider one way inheritance +# local found = false +# for kind, mods, type in ldoc.kinds() do +# for mod in mods() do +# local name = display_name(mod) +# if name == super then +# curr = mod +# found = true +# end +# if found then break end +# end +# if found then break end +# end +# if not found then curr = nil end +# end + +# --------- merge modules content with supermodules ------------- +# local all_module_kinds = {} +# if module then +# for kind,items in module.kinds() do +# local myitems = {} +# for item in items() do +# myitems[#myitems + 1] = item +# end +# all_module_kinds[#all_module_kinds + 1] = { kind = kind, items = myitems } +# end +# local filtered_kinds = { "Constructors", "Static module functions", +# "Functions", "Methods", "lib.gears.object.properties Functions" } +# for supermodule in iter(hierarchy) do +# for kind,items in supermodule.kinds() do +# local ignored = false +# for _,filtered in ldoc.pairs(filtered_kinds) do +# if kind == filtered then +# ignored = true +# break +# end +# end +# if not ignored then +# local curr_kind = nil +# for k in iter(all_module_kinds) do +# if k.kind == kind then +# curr_kind = k +# break +# end +# end +# if not curr_kind then +# curr_kind = { kind = kind, items = {} } +# all_module_kinds[#all_module_kinds + 1] = curr_kind +# end +# for item in items() do +# local tobeadded = true +# for i in iter(curr_kind.items) do +# if item.name == i.name then +# tobeadded = false +# break +# end +# end +# if tobeadded then +# item.inherited = true -- force inherited status +# curr_kind.items[#curr_kind.items + 1] = item +# end +# end +# end +# end +# end +# end +