diff --git a/docs/config.ld b/docs/config.ld index 5e8550405..1a77ccf53 100644 --- a/docs/config.ld +++ b/docs/config.ld @@ -186,7 +186,7 @@ local function default_format(self, callback) end end -local named_tags = {} +local named_tags, item_id = {}, 1 -- Add a new @something which can be used in any types. -- @tparam table args @@ -468,6 +468,9 @@ end local function init_custom_types(item) if item.is_init then return end + -- Give each item an unique identifier so the JavaScript can locate them. + item.uid, item_id = item_id, item_id + 1 + item.delims, item.auto_usage, item.auto_params = {}, {}, {} local to_rm = {} diff --git a/docs/ldoc.css b/docs/ldoc.css index 76763fc79..04aa7ae88 100644 --- a/docs/ldoc.css +++ b/docs/ldoc.css @@ -443,3 +443,11 @@ pre .url { color: #272fc2; text-decoration: underline; } background-repeat:no-repeat; color:transparent; } + +/* Hide some extra documentation noise by default */ +.hide_extra { + display: none +} +.show_more { + display: default +} diff --git a/docs/ldoc.ltp b/docs/ldoc.ltp index 37d37a189..ea1b4a7e4 100644 --- a/docs/ldoc.ltp +++ b/docs/ldoc.ltp @@ -9,6 +9,17 @@ # if ldoc.custom_css then -- add custom CSS file if configured. # end + + @@ -300,35 +311,42 @@ # end -- if usage -# 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 = item.get_auto_params(custom[1], value) -# if sub_values then - -# end -- if item.auto_params -# end -- for - -# end -- if tag -# end -- iter tags -# end -- ldoc.custom_tags +
+ + Click to display more + + + +# 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 = item.get_auto_params(custom[1], value) +# if sub_values then + +# end -- if item.auto_params +# end -- for + +# end -- if tag +# end -- iter tags +# end -- ldoc.custom_tags +
# end -- for items