Move hooks docs to their own section
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
{%
|
||||
local kinds = {}
|
||||
local kindsIpairs = {}
|
||||
for kind, items in mod.kinds() do
|
||||
for kind, items, _, summary in mod.kinds() do
|
||||
local name = kind
|
||||
if kind == "Tables" then
|
||||
name = "Fields"
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
local value = {}
|
||||
value.kind = name
|
||||
value.summary = summary
|
||||
value.items = kinds[name]
|
||||
table.insert(kindsIpairs, value)
|
||||
end
|
||||
@@ -33,9 +34,16 @@
|
||||
|
||||
{% for i, value in ipairs(kindsIpairs) do
|
||||
local kind = value.kind
|
||||
local summary = value.summary
|
||||
local items = value.items
|
||||
%}
|
||||
<h1 class="title">{{kind}}</h1>
|
||||
<header class="section">
|
||||
<h1>{{kind}}</h1>
|
||||
{% if summary ~= nil then %}
|
||||
<div class="section-separator"></div>
|
||||
<h2>{* ldoc.markup(summary) *}</h2>
|
||||
{% end %}
|
||||
</header>
|
||||
|
||||
{% for item, _ in pairs(items) do %}
|
||||
<section class="method" id="{{item.name}}">
|
||||
|
||||
@@ -3,6 +3,26 @@
|
||||
local function isKindExpandable(kind)
|
||||
return kind ~= "Manual"
|
||||
end
|
||||
|
||||
local function isSectionEmpty(mod, sections)
|
||||
if type(sections) == "table" then
|
||||
for _, v in pairs(mod.items) do
|
||||
for _, section in pairs(sections) do
|
||||
if v.section_id == section then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
local section = sections
|
||||
for _, v in pairs(mod.items) do
|
||||
if v.section_id == section then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
%}
|
||||
|
||||
<nav>
|
||||
@@ -40,48 +60,42 @@ end
|
||||
end)
|
||||
end %}
|
||||
|
||||
{%
|
||||
local isThereFunctions = false
|
||||
for k, v in pairs(currentMod.items) do
|
||||
if (v.kind == "functions") then
|
||||
isThereFunctions = true
|
||||
break
|
||||
end
|
||||
end
|
||||
%}
|
||||
|
||||
{% if isThereFunctions then %}
|
||||
{% if not isSectionEmpty(currentMod, "function") then %}
|
||||
<li>
|
||||
<label class="colorful-label">FUNCTIONS</label>
|
||||
</li>
|
||||
{% end %}
|
||||
|
||||
{% for k, v in pairs(currentMod.items) do %}
|
||||
{% if (v.kind == "functions") then %}
|
||||
{% if (v.section_id == "function") then %}
|
||||
<li>
|
||||
{* ldoc.sidebar_item(v, currentMod) *}
|
||||
</li>
|
||||
{% end %}
|
||||
{% end %}
|
||||
|
||||
{%
|
||||
local isThereFields = false
|
||||
for k, v in pairs(currentMod.items) do
|
||||
if (v.kind == "fields" or v.kind == "tables") then
|
||||
isThereFields = true
|
||||
break
|
||||
end
|
||||
end
|
||||
%}
|
||||
|
||||
{% if isThereFields then %}
|
||||
{% if not isSectionEmpty(currentMod, {"field", "table"}) then %}
|
||||
<li>
|
||||
<label class="colorful-label">FIELDS</label>
|
||||
</li>
|
||||
{% end %}
|
||||
|
||||
{% for k, v in pairs(currentMod.items) do %}
|
||||
{% if (v.kind == "fields" or v.kind == "tables") then %}
|
||||
{% if (v.section_id == "field" or v.section_id == "table") then %}
|
||||
<li>
|
||||
{* ldoc.sidebar_item(v, currentMod) *}
|
||||
</li>
|
||||
{% end %}
|
||||
{% end %}
|
||||
|
||||
{% if not isSectionEmpty(currentMod, "hook") then %}
|
||||
<li>
|
||||
<label class="colorful-label">HOOKS</label>
|
||||
</li>
|
||||
{% end %}
|
||||
|
||||
{% for k, v in pairs(currentMod.items) do %}
|
||||
{% if (v.section_id == "hook") then %}
|
||||
<li>
|
||||
{* ldoc.sidebar_item(v, currentMod) *}
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user