2016-08-07 19:01:56 +03:00
|
|
|
<!--
|
2020-02-10 14:34:58 +03:00
|
|
|
Copyright (c) 2016-2020 Martin Donath <martin.donath@squidfunk.com>
|
2016-08-07 19:01:56 +03:00
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to
|
|
|
|
deal in the Software without restriction, including without limitation the
|
|
|
|
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
IN THE SOFTWARE.
|
|
|
|
-->
|
|
|
|
|
2017-02-26 19:06:13 +03:00
|
|
|
<!-- Determine class according to level -->
|
2019-06-15 16:16:14 +03:00
|
|
|
{% set class = "md-nav__item" %}
|
|
|
|
{% if nav_item.active %}
|
|
|
|
{% set class = "md-nav__item md-nav__item--active" %}
|
|
|
|
{% endif %}
|
2017-02-26 19:06:13 +03:00
|
|
|
|
2016-08-07 19:01:56 +03:00
|
|
|
<!-- Main navigation item with nested items -->
|
2019-06-15 16:16:14 +03:00
|
|
|
{% if nav_item.children %}
|
2017-02-26 19:06:13 +03:00
|
|
|
<li class="{{ class }} md-nav__item--nested">
|
2016-08-07 19:01:56 +03:00
|
|
|
|
2016-09-23 12:56:25 +03:00
|
|
|
<!-- Active checkbox expands items contained within nested section -->
|
2019-06-15 16:16:14 +03:00
|
|
|
{% if nav_item.active %}
|
2019-11-26 12:03:53 +03:00
|
|
|
<input
|
2020-02-24 20:07:50 +03:00
|
|
|
class="md-nav__toggle md-toggle"
|
2019-11-26 12:03:53 +03:00
|
|
|
data-md-toggle="{{ path }}"
|
|
|
|
type="checkbox"
|
|
|
|
id="{{ path }}"
|
|
|
|
checked
|
|
|
|
/>
|
2019-06-15 16:16:14 +03:00
|
|
|
{% else %}
|
2019-11-26 12:03:53 +03:00
|
|
|
<input
|
2020-02-24 20:07:50 +03:00
|
|
|
class="md-nav__toggle md-toggle"
|
2019-11-26 12:03:53 +03:00
|
|
|
data-md-toggle="{{ path }}"
|
|
|
|
type="checkbox"
|
|
|
|
id="{{ path }}"
|
|
|
|
/>
|
2019-06-15 16:16:14 +03:00
|
|
|
{% endif %}
|
2016-08-07 19:01:56 +03:00
|
|
|
|
2016-09-23 12:56:25 +03:00
|
|
|
<!-- Expand active pages -->
|
2018-01-11 23:47:16 +03:00
|
|
|
<label class="md-nav__link" for="{{ path }}">
|
2019-06-15 16:23:03 +03:00
|
|
|
{{ nav_item.title }}
|
2020-08-28 19:20:23 +03:00
|
|
|
<span class="md-nav__icon md-icon"></span>
|
2016-09-24 19:52:37 +03:00
|
|
|
</label>
|
2020-03-18 19:28:26 +03:00
|
|
|
<nav
|
|
|
|
class="md-nav"
|
|
|
|
aria-label="{{ nav_item.title }}"
|
|
|
|
data-md-level="{{ level }}"
|
|
|
|
>
|
2018-01-11 23:47:16 +03:00
|
|
|
<label class="md-nav__title" for="{{ path }}">
|
2020-08-28 19:20:23 +03:00
|
|
|
<span class="md-nav__icon md-icon"></span>
|
2019-06-15 16:23:03 +03:00
|
|
|
{{ nav_item.title }}
|
2016-12-28 18:20:52 +03:00
|
|
|
</label>
|
2020-02-16 02:23:50 +03:00
|
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
2016-09-23 12:56:25 +03:00
|
|
|
|
2016-09-24 19:52:37 +03:00
|
|
|
<!-- Render nested item list -->
|
2019-06-15 16:16:14 +03:00
|
|
|
{% set base = path %}
|
|
|
|
{% for nav_item in nav_item.children %}
|
|
|
|
{% set path = base + "-" + loop.index | string %}
|
|
|
|
{% set level = level + 1 %}
|
|
|
|
{% include "partials/nav-item.html" %}
|
|
|
|
{% endfor %}
|
2016-09-24 19:52:37 +03:00
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
</li>
|
2016-09-23 12:56:25 +03:00
|
|
|
|
2017-01-01 17:59:44 +03:00
|
|
|
<!-- Currently active page -->
|
2019-06-15 16:16:14 +03:00
|
|
|
{% elif nav_item == page %}
|
2017-02-26 19:06:13 +03:00
|
|
|
<li class="{{ class }}">
|
2020-03-06 17:50:11 +03:00
|
|
|
{% set toc = page.toc %}
|
2016-09-24 19:52:37 +03:00
|
|
|
|
|
|
|
<!-- Active checkbox expands items contained within nested section -->
|
2019-11-26 12:03:53 +03:00
|
|
|
<input
|
2020-02-24 20:07:50 +03:00
|
|
|
class="md-nav__toggle md-toggle"
|
2019-11-26 12:03:53 +03:00
|
|
|
data-md-toggle="toc"
|
|
|
|
type="checkbox"
|
|
|
|
id="__toc"
|
|
|
|
/>
|
2016-09-24 19:52:37 +03:00
|
|
|
|
2017-02-09 01:13:13 +03:00
|
|
|
<!-- Hack: see partials/toc.html for more information -->
|
2020-03-06 17:50:11 +03:00
|
|
|
{% if toc | first is defined and "\x3ch1 id=" in page.content %}
|
|
|
|
{% set toc = (toc | first).children %}
|
2019-06-15 16:16:14 +03:00
|
|
|
{% endif %}
|
2016-12-30 23:11:05 +03:00
|
|
|
|
2017-01-01 17:59:44 +03:00
|
|
|
<!-- Render table of contents, if not empty -->
|
2020-03-06 17:50:11 +03:00
|
|
|
{% if toc | first is defined %}
|
2018-06-10 15:45:16 +03:00
|
|
|
<label class="md-nav__link md-nav__link--active" for="__toc">
|
2019-06-15 16:23:03 +03:00
|
|
|
{{ nav_item.title }}
|
2020-08-28 19:20:23 +03:00
|
|
|
<span class="md-nav__icon md-icon"></span>
|
2016-12-30 23:11:05 +03:00
|
|
|
</label>
|
2019-06-15 16:16:14 +03:00
|
|
|
{% endif %}
|
2019-11-26 12:03:53 +03:00
|
|
|
<a
|
|
|
|
href="{{ nav_item.url | url }}"
|
|
|
|
title="{{ nav_item.title | striptags }}"
|
|
|
|
class="md-nav__link md-nav__link--active"
|
|
|
|
>
|
2019-06-15 16:23:03 +03:00
|
|
|
{{ nav_item.title }}
|
2016-09-24 19:52:37 +03:00
|
|
|
</a>
|
|
|
|
|
|
|
|
<!-- Show table of contents -->
|
2020-03-06 17:50:11 +03:00
|
|
|
{% if toc | first is defined %}
|
2019-06-15 16:16:14 +03:00
|
|
|
{% include "partials/toc.html" %}
|
|
|
|
{% endif %}
|
2016-08-07 19:01:56 +03:00
|
|
|
</li>
|
|
|
|
|
|
|
|
<!-- Main navigation item -->
|
2019-06-15 16:16:14 +03:00
|
|
|
{% else %}
|
2017-02-26 19:06:13 +03:00
|
|
|
<li class="{{ class }}">
|
2019-11-26 12:03:53 +03:00
|
|
|
<a
|
|
|
|
href="{{ nav_item.url | url }}"
|
|
|
|
title="{{ nav_item.title | striptags }}"
|
|
|
|
class="md-nav__link"
|
|
|
|
>
|
2019-06-15 16:23:03 +03:00
|
|
|
{{ nav_item.title }}
|
2017-02-26 19:06:13 +03:00
|
|
|
</a>
|
2016-08-07 19:01:56 +03:00
|
|
|
</li>
|
2019-06-15 16:16:14 +03:00
|
|
|
{% endif %}
|