# local title = module and ldoc.module_typename(module).." "..module.name.." - "..ldoc.title or ldoc.title $(title) # if ldoc.custom_css then -- add custom CSS file if configured. # end
# local no_spaces = ldoc.no_spaces # local use_li = ldoc.use_li # local display_name = ldoc.display_name # local iter = ldoc.modules.iter # local function un_cmake(s) return s:gsub(";", ";"):gsub(""", '"'):gsub('&#34', '"') end # local function M(txt,item) return ldoc.markup(txt and un_cmake(txt) or nil,item,ldoc.plain) end # local nowrap = ldoc.wrap and '' or 'nowrap' # local html_space = function(s) return s:gsub(" ", "%%20") 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 # -- Poke a hole to allow config.ld code to have a global initialization. # for m in iter(ldoc.modules) do # if #m.items > 0 then # display_name(m.items[1]) # m.items[1].global_init(ldoc) # break # end # 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
# if ldoc.body then -- verbatim HTML as contents; 'non-code' entries $(un_cmake(ldoc.body)) # elseif module then -- module documentation

Module: $(module.name)

$(M(module.summary,module))

$(M(module.description,module))

# if module.usage then # local li,il = use_li(module.usage)

Usage:

    # for usage in iter(module.usage) do $(li)
    $(ldoc.escape(un_cmake(usage)))
    $(il) # end -- for
# end -- if usage
# if module.tags.supermodule then

Class Hierarchy

# local function draw_hierary_recursifly(i) # local is_root_level = (i == #hierarchy)
  • # local mod = hierarchy[i] # local name = display_name(hierarchy[i]) # if mod == module then $(name) # else $(name) # end
  • # if i > 1 then
  • # draw_hierary_recursifly(i - 1)
  • # end
# end -- function draw_hierary_recursifly # draw_hierary_recursifly(#hierarchy)
# end -- module.tags.supermodule # if module.tags.include then $(M(ldoc.include_file(module.tags.include))) # end # if module.info then

Info:

    # for tag, value in module.info:iter() do # if tag == 'Author' then
  • Originally authored by: $(M(value,module))
    (Full contributors list available on our github project)
  • # else
  • $(tag): $(M(value,module))
  • # end # end
# end -- if module.info # if module.see then
# local li,il = use_li(module.see) # local list_or_p =(#module.see > 1) and 'ul' or 'p'

See also:

<$(list_or_p)> # for see in iter(module.see) do $(li)$(see.label)$(il) # end -- for
# end -- if module.see
# if not ldoc.no_summary then # -- bang out the tables of item types for this module (e.g Functions, Tables, etc) # local last_kind = "" # for k in iter(all_module_kinds) do # local kind = k.kind # if not kind:match("^ldoc_skip") then # if last_kind ~= "" then # end

$(kind)

# end # for item in iter(k.items) do if not item.tags.hidden then # local dn = display_name(item) # local inherited = (item.baseclass ~= module.name) # if item.sanitize_type then item.sanitize_type(item, ldoc) end # if item.display_type and not item.compact_signature then # else # end # end end -- for items # last_kind = kind #end -- for kinds
$(dn) $(item.display_type) $(dn) # if item.display_type and item.compact_signature then $(item.display_type) # end $(M(item.summary,item)) # if item.tags.is_deprecated then Deprecated # end # if item.tags.readonly then Read only # end # if inherited then Inherited from $(item.baseclass) # end


#end -- if not no_summary # --- currently works for both Functions and Tables. The params field either contains # --- function parameters or table fields. # local show_return = not ldoc.no_return_or_parms # local show_parms, last_kind = show_return, "" # for k in iter(all_module_kinds) do # local kind = k.kind # local kitem = module.kinds:get_item(kind) # local has_description = kitem and ldoc.descript(kitem) ~= "" # if not kind:match("^ldoc_skip") then # if last_kind ~= "" then # end

$(kind)

# end $(M(module.kinds:get_section_description(kind),nil)) # if kitem then # if has_description then
$(M(ldoc.descript(kitem),kitem))
# end # if kitem.usage then

Usage:

$(ldoc.prettify(un_cmake(kitem.usage[1])))
# end # end # if not kind:match("^ldoc_skip") then
# end # for item in iter(k.items) do if not item.tags.hidden then
🔗 $(display_name(item)) # if item.display_inheritance then · Inherited from $(item.display_inheritance) # end -- display_inheritance # if item.display_type then $(item.display_type) # end # if item.baseclass ~= module.name then · Inherited from $(M(item.baseclass, item)) # end # if item.extra_summary then # for _, col in ldoc.ipairs(item.extra_summary) do · $((col.showcount and col.count.." " or "")..col.title) # end -- summary col # end -- summary # if ldoc.prettify_files and ldoc.is_file_prettified[item.module.file.filename] then line $(item.lineno) # end
$(M(ldoc.descript(item),item)) # if kind == "Object properties" and item.params[1] and #item.metadata > 0 then

Constraints:

# local current_level # current_level = function(metadata, level) # for _, metadata in ldoc.ipairs(metadata, level) do # if metadata.description and not metadata.description:match("^[\t\n ]*$") then # end # current_level(metadata.metadata, level + 1) # end # end --current_level # current_level(item.metadata or {}, 0)
$(metadata.title)$(#(metadata.metadata or {}) > 0 and ":" or "") # if metadata.datatype then ($(metadata.datatype)) # end : $(metadata.description)
# elseif show_parms and item.params and #item.params > 0 and not item.hide_params then # local subnames = module.kinds:type_of(item).subnames # if subnames then

$(subnames):

# end # local has_optional, has_named_call = false, false # for parm in iter(item.params) do # local param,sublist = item:subparam(parm) # has_named_call = has_named_call or (sublist and item.is_named_call) # for p in iter(param) do # local def = item:default_of_param(p) # has_optional = has_optional or (def and def ~= true) # end # end # if has_named_call then
Note: This $(item.kind) uses named parameters calling convention. It means you call it with $(M('`{}`')) and omit the parantheses. For example, calling this will all default argument would be $(item.name){}. This is a Lua shortcut syntax equivalent to $(item.name)({}). args is only a placeholder name for the "lone table argument" used in named parameters calls.
# end # if has_optional then # end # for parm in iter(item.params) do # local param,sublist = item:subparam(parm) # if sublist then # local def = item:default_of_param(sublist) # if has_optional then # if def and def ~= true then # elseif def then # else # end # end # end # for p in iter(param) do # local name,tp,def = item:display_name_of(p), ldoc.typename(item:type_of_param(p)), item:default_of_param(p) # if has_optional then # if def and def ~= true then # elseif def then # else # end # end # end # end -- for
Name Type(s) DescriptionDefault value
$(sublist) $(def and 'Optional' or '') table $(M(item.params.map[sublist],item)) $(def)UndefinedNot applicable
$(name) $(def and 'Optional' or '') $(tp) $(M(item.params.map[p],item))$(def)UndefinedNot applicable
# end -- if params # if show_return and item.retgroups then local groups = item.retgroups

Returns:

# for i,group in ldoc.ipairs(groups) do local li,il = use_li(group)
    # for r in group:iter() do local type, ctypes = item:return_type(r); local rt = ldoc.typename(type) $(li) # if rt ~= '' then $(rt) # end $(M(r.text,item))$(il) # if ctypes then
      # for c in ctypes:iter() do
    • $(c.name) $(ldoc.typename(c.type)) $(M(c.comment,item))
    • # end
    # end -- if ctypes # end -- for r
# if i < #groups then

Or

# end # end -- for group # end -- if returns # if show_return and item.raise then

Raises:

$(M(item.raise,item)) # end # if item.see then # local li,il = use_li(item.see)

See also:

# for see in iter(item.see) do # 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 "" # end -- for
$(see.label) $(see_item and M(see_item.summary)) $(see_mod) # if see_item or see.name == "" then $(see.name == "" and "module" or (see_item and see_item.kind)) # end
# end -- if see # if item.usage then # local li,il = use_li(item.usage)

Usage:

    # for usage in iter(item.usage) do $(li)
    $(ldoc.prettify(un_cmake(usage)))
    $(il) # end -- for
# end -- if usage # if item.has_show_more then
Click to display more
# end # if ldoc.custom_tags then # for custom in iter(ldoc.custom_tags) do # local tag = item.tags[custom[1]] # if tag and not custom.hidden then # local group_begin, group_end, row_type_begin, row_type_end, group_header = item.get_delim(custom[1])

$(custom.title or custom[1]):

<$(group_begin)> # if group_header then # for _, g in ldoc.ipairs(group_header) do $(g) # end -- for g # end -- if group_header then # for value in iter(tag) do <$(row_type_begin)>$(custom.format and custom.format(value, item, M) or M(value)) # local sub_values, sub_custom, extra_data = item.get_auto_params(custom[1], value) # if sub_values then
    # for _, value in ldoc.ipairs(sub_values) do
  • $(sub_custom.format(value, item, M))
  • # end -- for auto_params
# end -- if item.auto_params # if extra_data.usage then

$(extra_data.usage)
# end -- extra_data.usage # end -- for # end -- if tag # end -- iter tags # end -- ldoc.custom_tags
# end end -- for items # last_kind = kind # end -- for kinds
# else -- if module; project-level contents # if ldoc.description then

$(M(ldoc.description,nil))

# end # if ldoc.full_description then

$(M(ldoc.full_description,nil))

# end # for kind, mods in ldoc.kinds() do

$(kind)

# kind = kind:lower() # for m in mods() do # end -- for modules
$(m.name) $(M(ldoc.strip_header(m.summary),m))
# end -- for kinds # end -- if module
generated by LDoc $(ldoc.version)