blob: 3d609b0acbdc68d0f1e156bf3dc0e7e17e74d438 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
{% macro _toc_tree_inner(toc) -%}
<ul>
{% for toc_item in toc %}
<li><a href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
{{ _toc_tree_inner(toc_item.children) }}
{% endfor %}
</ul>
{%- endmacro %}
{% macro toc_tree(toc) -%}
{# This ignores H1s #}
{% for toc_item in toc %}
{{ _toc_tree_inner(toc_item.children) }}
{% endfor %}
{%- endmacro %}
{% macro nav_tree(nav) -%}
<ul>
{% for nav_item in nav %}
{% if not nav_item.children %}
<li>
<a href="{{ nav_item.url }}">{{ nav_item.title }}</a>
</li>
{% if nav_item == page %}
{{ toc_tree(page.toc) }}
{% endif %}
{% else %}
<li>
{{ nav_item.title }}
{{ nav_tree(nav_item.children) }}
</li>
{% endif %}
{% endfor %}
</ul>
{%- endmacro %}
<h3>Navigation</h3>
<nav>
{{ nav_tree(nav) }}
{% if theme.extra_nav_links %}
<hr>
<ul>
{% for text, uri in theme.extra_nav_links.items() %}
<li class="toctree-l1"><a href="{{ uri }}">{{ text }}</a></li>
{% endfor %}
</ul>
{% endif %}
</nav>
|