# local function M(txt, item) return ldoc.markup(txt, item, ldoc.plain) end # -- LDoc doesn't expose this, even though it does expose `pairs`. *insert confused face* # local function next(tbl) # local n, t = ldoc.pairs(tbl) # return n(t) # end
# if ldoc.body then -- verbatim HTML as contents; 'non-code' entries
$(ldoc.body)
# elseif module then

$(ldoc.module_typename(module)) $(module.name)

$(M(module.summary, module))

$(M(module.description, module))

# if module.info or next(module.tags) then
# for tag, value in module.info:iter() do
$(tag) $(M(value, module))
# end
# end
# if not ldoc.no_summary then

Table of contents

# for kind, items in module.kinds() do

$(kind)

# for item in items() do # end
$(ldoc.display_name(item)) $(M(item.summary, item))
# end
# end # for kind, items in module.kinds() do # local kitem = module.kinds:get_item(kind) # local has_description = kitem and ldoc.descript(kitem) ~= ""

$(kind)

# local section_description = module.kinds:get_section_description(kind) # if section_description then
$(M(section_description, nil))
# end # if has_description then
$(M(ldoc.descript(kitem), kitem))
# end
# for item in items() do
$(ldoc.display_name(item)) # if ldoc.prettify_files and ldoc.is_file_prettified[item.module.file.filename] then line $(item.lineno) # end # if item.tags["async"] then async # end
$(M(ldoc.descript(item), item))
# if not ldoc.no_return_or_params then # if item.params and #item.params > 0 then
# local subnames = module.kinds:type_of(item).subnames # if subnames then

$(subnames):

# end
    # for parm in ldoc.modules.iter(item.params) do # local param,sublist = item:subparam(parm) # if sublist then
  • $(sublist)$(M(item.params.map[sublist], item))
      # end # for p in ldoc.modules.iter(param) do # local name = item:display_name_of(p) # local type_name = ldoc.typename(item:type_of_param(p)) # local default = item:default_of_param(p)
    • $(name) # local description = item.params.map[p] # if description and description ~= "" then : $(M(description, item)) # end
      # if type_name ~= '' then
      type $(type_name)
      # end # if default == true then
      optional
      # elseif default then
      default $(default)
      # end # if item:readonly(p) then
      readonly
      # end
    • # end # if sublist then
    # end # end
# end # if item.retgroups then # -- I only need a single return group for now # local group = item.retgroups[1]
# if item.tags["async"] then

Callback parameters:

# else

Returns:

# end
    # for r in group:iter() do
  • # local description = r.text # if description and description ~= "" then
    $(M(description, item))
    # end # local t, ctypes = item:return_type(r) # local rt = ldoc.typename(t) # local optional = false # if rt:match("optional ") then # optional = true # rt = rt:match("optional (.*)") # end
    type $(rt)
    # if optional then
    optional
    # end
  • # end
# end # end # if item.usage then

Usage:

# for usage in ldoc.modules.iter(item.usage) do
$(ldoc.prettify(usage))
# end
# end
# end
# end # else -- elseif module -> project-level content

$(ldoc.project)

# 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:lower()

$(kind)

# for m in mods() do # end
$(m.name) $(M(ldoc.strip_header(m.summary), m))
# end
# end