doc: Hide the newly auto-generated content by default.
First of all, yes, JavaScript in the doc. I don't like this either. The reason is that the new sections are super useful *when you need them*. However, in practice, that's rare. So better not make the signal to noise ratio worst. Future commit will introduce an auto-generated summary of what's hidden.
This commit is contained in:
parent
ee912671eb
commit
a3a2fc1344
|
@ -186,7 +186,7 @@ local function default_format(self, callback)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local named_tags = {}
|
local named_tags, item_id = {}, 1
|
||||||
|
|
||||||
-- Add a new @something which can be used in any types.
|
-- Add a new @something which can be used in any types.
|
||||||
-- @tparam table args
|
-- @tparam table args
|
||||||
|
@ -468,6 +468,9 @@ end
|
||||||
local function init_custom_types(item)
|
local function init_custom_types(item)
|
||||||
if item.is_init then return end
|
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 = {}, {}, {}
|
item.delims, item.auto_usage, item.auto_params = {}, {}, {}
|
||||||
|
|
||||||
local to_rm = {}
|
local to_rm = {}
|
||||||
|
|
|
@ -443,3 +443,11 @@ pre .url { color: #272fc2; text-decoration: underline; }
|
||||||
background-repeat:no-repeat;
|
background-repeat:no-repeat;
|
||||||
color:transparent;
|
color:transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Hide some extra documentation noise by default */
|
||||||
|
.hide_extra {
|
||||||
|
display: none
|
||||||
|
}
|
||||||
|
.show_more {
|
||||||
|
display: default
|
||||||
|
}
|
||||||
|
|
|
@ -9,6 +9,17 @@
|
||||||
# if ldoc.custom_css then -- add custom CSS file if configured.
|
# if ldoc.custom_css then -- add custom CSS file if configured.
|
||||||
<link rel="stylesheet" href="$(ldoc.custom_css)" type="text/css" />
|
<link rel="stylesheet" href="$(ldoc.custom_css)" type="text/css" />
|
||||||
# end
|
# end
|
||||||
|
<script>
|
||||||
|
function show_extra(id) {
|
||||||
|
var cur = document.getElementById(id).className
|
||||||
|
|
||||||
|
if (cur == "hide_extra")
|
||||||
|
document.getElementById(id).className = "show_more"
|
||||||
|
else
|
||||||
|
document.getElementById(id).className = "hide_extra"
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
@ -300,35 +311,42 @@
|
||||||
</ul>
|
</ul>
|
||||||
# end -- if usage
|
# end -- if usage
|
||||||
|
|
||||||
# if ldoc.custom_tags then
|
<br />
|
||||||
# for custom in iter(ldoc.custom_tags) do
|
<a class="deprecated_h2" onclick="show_extra('$("item"..item.uid)')">
|
||||||
# local tag = item.tags[custom[1]]
|
Click to display more
|
||||||
# if tag and not custom.hidden then
|
</a>
|
||||||
# local group_begin, group_end, row_type_begin, row_type_end, group_header = item.get_delim(custom[1])
|
|
||||||
<h3>$(custom.title or custom[1]):</h3>
|
<span id=item$(item.uid) class="hide_extra">
|
||||||
<$(group_begin)>
|
# if ldoc.custom_tags then
|
||||||
# if group_header then
|
# for custom in iter(ldoc.custom_tags) do
|
||||||
<tr style='font-weight: bold;'>
|
# local tag = item.tags[custom[1]]
|
||||||
# for _, g in ldoc.ipairs(group_header) do
|
# if tag and not custom.hidden then
|
||||||
<th>$(g)</th>
|
# local group_begin, group_end, row_type_begin, row_type_end, group_header = item.get_delim(custom[1])
|
||||||
# end -- for g
|
<h3>$(custom.title or custom[1]):</h3>
|
||||||
</tr>
|
<$(group_begin)>
|
||||||
# end -- if group_header then
|
# if group_header then
|
||||||
# for value in iter(tag) do
|
<tr style='font-weight: bold;'>
|
||||||
<$(row_type_begin)>$(custom.format and custom.format(value, item, M) or M(value))</$(row_type_end)>
|
# for _, g in ldoc.ipairs(group_header) do
|
||||||
# local sub_values, sub_custom = item.get_auto_params(custom[1], value)
|
<th>$(g)</th>
|
||||||
# if sub_values then
|
# end -- for g
|
||||||
<ul>
|
</tr>
|
||||||
# for _, value in ldoc.ipairs(sub_values) do
|
# end -- if group_header then
|
||||||
<li>$(sub_custom.format(value, item, M))</li>
|
# for value in iter(tag) do
|
||||||
# end -- for auto_params
|
<$(row_type_begin)>$(custom.format and custom.format(value, item, M) or M(value))</$(row_type_end)>
|
||||||
</ul>
|
# local sub_values, sub_custom = item.get_auto_params(custom[1], value)
|
||||||
# end -- if item.auto_params
|
# if sub_values then
|
||||||
# end -- for
|
<ul>
|
||||||
</$(group_end)>
|
# for _, value in ldoc.ipairs(sub_values) do
|
||||||
# end -- if tag
|
<li>$(sub_custom.format(value, item, M))</li>
|
||||||
# end -- iter tags
|
# end -- for auto_params
|
||||||
# end -- ldoc.custom_tags
|
</ul>
|
||||||
|
# end -- if item.auto_params
|
||||||
|
# end -- for
|
||||||
|
</$(group_end)>
|
||||||
|
# end -- if tag
|
||||||
|
# end -- iter tags
|
||||||
|
# end -- ldoc.custom_tags
|
||||||
|
</span>
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
# end -- for items
|
# end -- for items
|
||||||
|
|
Loading…
Reference in New Issue