Skip to content

Commit f55c482

Browse files
committed
navigation
1 parent 818c840 commit f55c482

File tree

1 file changed

+54
-15
lines changed

1 file changed

+54
-15
lines changed

theme/toc.html

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,64 @@
1-
{% if nav_item.children %}
2-
{% if not nav_item.title.startswith("_") %}
1+
{# loop through all navigation items #}
2+
3+
{# if the current item title does not start with _ #}
4+
{% if not nav_item.title.startswith("_") %}
5+
{# if the current item has children #}
6+
{% if nav_item.children %}
37
<ul class="subnav">
48
<li><span>{{ nav_item.title }}</span></li>
9+
{# output children #}
510
{% for nav_item in nav_item.children %}
6-
{% include 'toc.html' %}
11+
{% include 'toc.html' %}
712
{% endfor %}
813
</ul>
9-
{% endif %}
10-
{% else %}
11-
{% if not nav_item.title.startswith("_") %}
12-
<li class="toctree-l1 {% if nav_item.active%}current{%endif%}">
13-
<a class="{% if nav_item.active%}current{%endif%}" href="{{ nav_item.url }}">{{ nav_item.title }}</a>
14+
{# if the current item does not have children #}
15+
{% else %}
16+
<li class="toctree-l1
17+
{# if current item is active #}
18+
{% if nav_item.active %}current{% endif %}
19+
{# if current page has ancestors and current item title prefixed with _ is identical to ancestor title (_ + Action <=> _Action) #}
20+
{% if current_page and current_page.ancestors %}{% for doc in current_page.ancestors %}{% if "_"+nav_item.title == doc.title and nav_item.title != "Tools" %}current{% endif %}{% endfor %}{% endif %}
21+
">
22+
<a class="
23+
{% if nav_item.active %}current{% endif %}
24+
{% if current_page and current_page.ancestors %}{% for doc in current_page.ancestors %}{% if "_"+nav_item.title == doc.title and nav_item.title != "Tools" %}current{% endif %}{% endfor %}{% endif %}
25+
" href="{{ nav_item.url }}">
26+
{{ nav_item.title }}
27+
</a>
28+
{# if current item is current page #}
1429
{% if nav_item == current_page %}
15-
<ul>
16-
{% for toc_item in toc %}
17-
{% if loop.index != 1 %}
18-
<li class="toctree-l3"><a href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
19-
{% endif %}
20-
{% endfor %}
21-
</ul>
30+
<ul>
31+
{# output headlines #}
32+
{% for toc_item in toc %}
33+
{% if loop.index != 1 %}
34+
<li class="toctree-l3"><a href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
35+
{% endif %}
36+
{% endfor %}
37+
</ul>
2238
{% endif %}
2339
</li>
2440
{% endif %}
2541
{% endif %}
42+
43+
{# if current page title is _Tools #}
44+
{% if nav_item.title == "_Tools" %}
45+
{% if current_page and current_page.title == "Tools" %}
46+
<ul class="subnav">
47+
{% for nav_item in nav_item.children %}
48+
{% include 'toc.html' %}
49+
{% endfor %}
50+
</ul>
51+
{% else %}
52+
{% if current_page and current_page.ancestors %}
53+
{% for doc in current_page.ancestors %}
54+
{% if nav_item.title == doc.title %}
55+
<ul class="subnav">
56+
{% for nav_item in nav_item.children %}
57+
{% include 'toc.html' %}
58+
{% endfor %}
59+
</ul>
60+
{% endif %}
61+
{% endfor %}
62+
{% endif %}
63+
{% endif %}
64+
{% endif %}

0 commit comments

Comments
 (0)