| 1 |
{#- |
| 2 |
This file was automatically generated - do not edit |
| 3 |
-#} |
| 4 |
{% macro render_status(nav_item, type) %} |
| 5 |
{% set class = "md-status md-status--" ~ type %} |
| 6 |
{% if config.extra.status and config.extra.status[type] %} |
| 7 |
<span class="{{ class }}" title="{{ config.extra.status[type] }}"> |
| 8 |
</span> |
| 9 |
{% else %} |
| 10 |
<span class="{{ class }}"></span> |
| 11 |
{% endif %} |
| 12 |
{% endmacro %} |
| 13 |
{% macro render_content(nav_item, ref = nav_item) %} |
| 14 |
{% if nav_item.meta and nav_item.meta.icon %} |
| 15 |
{% include ".icons/" ~ nav_item.meta.icon ~ ".svg" %} |
| 16 |
{% endif %} |
| 17 |
<span class="md-ellipsis"> |
| 18 |
{{ ref.title }} |
| 19 |
{% if nav_item.meta and nav_item.meta.subtitle %} |
| 20 |
<br> |
| 21 |
<small>{{ nav_item.meta.subtitle }}</small> |
| 22 |
{% endif %} |
| 23 |
</span> |
| 24 |
{% if nav_item.meta and nav_item.meta.status %} |
| 25 |
{{ render_status(nav_item, nav_item.meta.status) }} |
| 26 |
{% endif %} |
| 27 |
{% endmacro %} |
| 28 |
{% macro render_pruned(nav_item, ref = nav_item) %} |
| 29 |
{% set first = nav_item.children | first %} |
| 30 |
{% if first and first.children %} |
| 31 |
{{ render_pruned(first, ref) }} |
| 32 |
{% else %} |
| 33 |
<a href="{{ first.url | url }}" class="md-nav__link"> |
| 34 |
{{ render_content(ref) }} |
| 35 |
{% if nav_item.children | length > 0 %} |
| 36 |
<span class="md-nav__icon md-icon"></span> |
| 37 |
{% endif %} |
| 38 |
</a> |
| 39 |
{% endif %} |
| 40 |
{% endmacro %} |
| 41 |
{% macro render(nav_item, path, level) %} |
| 42 |
{% set class = "md-nav__item" %} |
| 43 |
{% if nav_item.active %} |
| 44 |
{% set class = class ~ " md-nav__item--active" %} |
| 45 |
{% endif %} |
| 46 |
{% if nav_item.pages %} |
| 47 |
{% if page in nav_item.pages %} |
| 48 |
{% set nav_item = page %} |
| 49 |
{% endif %} |
| 50 |
{% endif %} |
| 51 |
{% if nav_item.children %} |
| 52 |
{% set indexes = [] %} |
| 53 |
{% if "navigation.indexes" in features %} |
| 54 |
{% for nav_item in nav_item.children %} |
| 55 |
{% if nav_item.is_index and not index is defined %} |
| 56 |
{% set _ = indexes.append(nav_item) %} |
| 57 |
{% endif %} |
| 58 |
{% endfor %} |
| 59 |
{% endif %} |
| 60 |
{% if "navigation.tabs" in features %} |
| 61 |
{% if level == 1 and nav_item.active %} |
| 62 |
{% set class = class ~ " md-nav__item--section" %} |
| 63 |
{% set is_section = true %} |
| 64 |
{% endif %} |
| 65 |
{% if "navigation.sections" in features %} |
| 66 |
{% if level == 2 and nav_item.parent.active %} |
| 67 |
{% set class = class ~ " md-nav__item--section" %} |
| 68 |
{% set is_section = true %} |
| 69 |
{% endif %} |
| 70 |
{% endif %} |
| 71 |
{% elif "navigation.sections" in features %} |
| 72 |
{% if level == 1 %} |
| 73 |
{% set class = class ~ " md-nav__item--section" %} |
| 74 |
{% set is_section = true %} |
| 75 |
{% endif %} |
| 76 |
{% endif %} |
| 77 |
{% if "navigation.prune" in features %} |
| 78 |
{% if not is_section and not nav_item.active %} |
| 79 |
{% set class = class ~ " md-nav__item--pruned" %} |
| 80 |
{% set is_pruned = true %} |
| 81 |
{% endif %} |
| 82 |
{% endif %} |
| 83 |
<li class="{{ class }} md-nav__item--nested"> |
| 84 |
{% if not is_pruned %} |
| 85 |
{% set checked = "checked" if nav_item.active %} |
| 86 |
{% if "navigation.expand" in features and not checked %} |
| 87 |
{% set indeterminate = "md-toggle--indeterminate" %} |
| 88 |
{% endif %} |
| 89 |
<input class="md-nav__toggle md-toggle {{ indeterminate }}" type="checkbox" id="{{ path }}" {{ checked }}> |
| 90 |
{% if not indexes %} |
| 91 |
{% set tabindex = "0" if not is_section %} |
| 92 |
<label class="md-nav__link" for="{{ path }}" id="{{ path }}_label" tabindex="{{ tabindex }}"> |
| 93 |
{{ render_content(nav_item) }} |
| 94 |
<span class="md-nav__icon md-icon"></span> |
| 95 |
</label> |
| 96 |
{% else %} |
| 97 |
{% set index = indexes | first %} |
| 98 |
{% set class = "md-nav__link--active" if index == page %} |
| 99 |
<div class="md-nav__link md-nav__container"> |
| 100 |
<a href="{{ index.url | url }}" class="md-nav__link {{ class }}"> |
| 101 |
{{ render_content(index, nav_item) }} |
| 102 |
</a> |
| 103 |
{% if nav_item.children | length > 1 %} |
| 104 |
{% set tabindex = "0" if not is_section %} |
| 105 |
<label class="md-nav__link {{ class }}" for="{{ path }}" id="{{ path }}_label" tabindex="{{ tabindex }}"> |
| 106 |
<span class="md-nav__icon md-icon"></span> |
| 107 |
</label> |
| 108 |
{% endif %} |
| 109 |
</div> |
| 110 |
{% endif %} |
| 111 |
<nav class="md-nav" data-md-level="{{ level }}" aria-labelledby="{{ path }}_label" aria-expanded="{{ nav_item.active | tojson }}"> |
| 112 |
<label class="md-nav__title" for="{{ path }}"> |
| 113 |
<span class="md-nav__icon md-icon"></span> |
| 114 |
{{ nav_item.title }} |
| 115 |
</label> |
| 116 |
<ul class="md-nav__list" data-md-scrollfix> |
| 117 |
{% for nav_item in nav_item.children %} |
| 118 |
{% if not indexes or nav_item != indexes | first %} |
| 119 |
{{ render(nav_item, path ~ "_" ~ loop.index, level + 1) }} |
| 120 |
{% endif %} |
| 121 |
{% endfor %} |
| 122 |
</ul> |
| 123 |
</nav> |
| 124 |
{% else %} |
| 125 |
{{ render_pruned(nav_item) }} |
| 126 |
{% endif %} |
| 127 |
</li> |
| 128 |
{% elif nav_item == page %} |
| 129 |
<li class="{{ class }}"> |
| 130 |
{% set toc = page.toc %} |
| 131 |
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc"> |
| 132 |
{% set first = toc | first %} |
| 133 |
{% if first and first.level == 1 %} |
| 134 |
{% set toc = first.children %} |
| 135 |
{% endif %} |
| 136 |
{% if toc %} |
| 137 |
<label class="md-nav__link md-nav__link--active" for="__toc"> |
| 138 |
{{ render_content(nav_item) }} |
| 139 |
<span class="md-nav__icon md-icon"></span> |
| 140 |
</label> |
| 141 |
{% endif %} |
| 142 |
<a href="{{ nav_item.url | url }}" class="md-nav__link md-nav__link--active"> |
| 143 |
{{ render_content(nav_item) }} |
| 144 |
</a> |
| 145 |
{% if toc %} |
| 146 |
{% include "partials/toc.html" %} |
| 147 |
{% endif %} |
| 148 |
</li> |
| 149 |
{% else %} |
| 150 |
<li class="{{ class }}"> |
| 151 |
<a href="{{ nav_item.url | url }}" class="md-nav__link"> |
| 152 |
{{ render_content(nav_item) }} |
| 153 |
</a> |
| 154 |
</li> |
| 155 |
{% endif %} |
| 156 |
{% endmacro %} |