Skip to content
Snippets Groups Projects
Commit c97faeac authored by Emmanuele Bassi's avatar Emmanuele Bassi
Browse files

template: Improve the TOC sidebar of types

Like we do for extra content files, we should generate a TOC of the
sub-headings inside the description of types: classes, interfaces, and
structured data. This way it's easier to navigate to sub-sections, and
to get their location for links.
parent 023702fb
No related branches found
No related tags found
No related merge requests found
......@@ -57,6 +57,19 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
<p id="toc-title">Content</p>
<ul class="toc-list">
<li class="toc-list-item"><a href="#description"><span class="link-text">Description</span></a></li>
{% if class.description_toc %}
<ul class="toc-list">
{% if class.description_toc|length == 1 %}
{% for header in class.description_toc[0].children %}
<li class="toc-list-item"><a href="#{{ header.id }}"><span class="link-text">{{ header.name }}</span></a></li>
{% endfor %}
{% else %}
{% for header in class.description_toc %}
<li class="toc-list-item"><a href="#{{ header.id }}"><span class="link-text">{{ header.name }}</span></a></li>
{% endfor %}
{% endif %}
</ul>
{% endif %}
{% if CONFIG.show_class_hierarchy and (class.ancestors or class.interfaces) %}
<li class="toc-list-item"><a href="#hierarchy"><span class="link-text">Hierarchy</span></a></li>
{% endif %}
......
......@@ -56,6 +56,19 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
<p id="toc-title">Content</p>
<ul class="toc-list">
<li class="toc-list-item"><a href="#description"><span class="link-text">Description</span></a></li>
{% if interface.description_toc %}
<ul class="toc-list">
{% if interface.description_toc|length == 1 %}
{% for header in interface.description_toc[0].children %}
<li class="toc-list-item"><a href="#{{ header.id }}"><span class="link-text">{{ header.name }}</span></a></li>
{% endfor %}
{% else %}
{% for header in interface.description_toc %}
<li class="toc-list-item"><a href="#{{ header.id }}"><span class="link-text">{{ header.name }}</span></a></li>
{% endfor %}
{% endif %}
</ul>
{% endif %}
{{ navbar_block(interface.type_funcs, "Functions", "#type-functions") }}
{{ navbar_block(interface.methods, "Methods", "#methods") }}
{{ navbar_block(interface.properties, "Properties", "#properties") }}
......
......@@ -53,6 +53,19 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
<p id="toc-title">Content</p>
<ul class="toc-list">
<li class="toc-list-item"><a href="#description"><span class="link-text">Description</span></a></li>
{% if struct.description_toc %}
<ul class="toc-list">
{% if struct.description_toc|length == 1 %}
{% for header in struct.description_toc[0].children %}
<li class="toc-list-item"><a href="#{{ header.id }}"><span class="link-text">{{ header.name }}</span></a></li>
{% endfor %}
{% else %}
{% for header in struct.description_toc %}
<li class="toc-list-item"><a href="#{{ header.id }}"><span class="link-text">{{ header.name }}</span></a></li>
{% endfor %}
{% endif %}
</ul>
{% endif %}
{{ navbar_block(struct.ctors, "Constructors", "#constructors") }}
{{ navbar_block(struct.type_funcs, "Functions", "#type-functions") }}
{{ navbar_block(struct.methods, "Methods", "#methods") }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment