1
0
Fork 0
jinjax/docs/theme/TocPage.jinja
Daniel Baumann 76fe8c2886
Merging upstream version 0.46.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-02-05 18:42:39 +01:00

21 lines
626 B
Django/Jinja

{#def page_toc, max_depth=3 #}
{% macro render_sub_items(pages) %}
{%- for section in pages %}
<li class="indent-{{ section.level }}">
<a href="#{{ section.id }}"><span>{{ section.name }}</span></a>
</li>
{% if section.level <= max_depth -%}
{{ render_sub_items(section.children) }}
{%- endif %}
{%- endfor %}
{% endmacro %}
<ul {{ attrs.render(class="cd-toc-page", data_component="TocPage") }}>
{%- for section in page_toc %}
<li class="indent-{{ section.level }}">
<a href="#{{ section.id }}"><span>{{ section.name }}</span></a>
</li>
{{ render_sub_items(section.children) }}
{%- endfor %}
</ul>