Formatting

This commit is contained in:
squidfunk 2021-02-25 17:51:38 +01:00
parent 7d5a463c60
commit dd3a4788cb
2 changed files with 7 additions and 17 deletions

View File

@ -1,7 +1,7 @@
{#- {#-
This file was automatically generated - do not edit This file was automatically generated - do not edit
-#} -#}
{% macro render_nav_item(nav_item, path, level) %} {% macro render(nav_item, path, level) %}
{% set class = "md-nav__item" %} {% set class = "md-nav__item" %}
{% if nav_item.active %} {% if nav_item.active %}
{% set class = class ~ " md-nav__item--active" %} {% set class = class ~ " md-nav__item--active" %}
@ -29,13 +29,8 @@
{{ nav_item.title }} {{ nav_item.title }}
</label> </label>
<ul class="md-nav__list" data-md-scrollfix> <ul class="md-nav__list" data-md-scrollfix>
{% set base = path %}
{% for nav_item in nav_item.children %} {% for nav_item in nav_item.children %}
{{ render_nav_item( {{ render(nav_item, path ~ "_" ~ loop.index, level + 1) }}
nav_item,
path = base ~ "_" ~ loop.index,
level = level + 1)
}}
{% endfor %} {% endfor %}
</ul> </ul>
</nav> </nav>
@ -68,4 +63,4 @@
</li> </li>
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{{ render_nav_item(nav_item, path, level) }} {{ render(nav_item, path, level) }}

View File

@ -20,8 +20,8 @@
IN THE SOFTWARE. IN THE SOFTWARE.
--> -->
<!-- Wrap everything into a macro to reduce file roundtrips (see #2213) --> <!-- Wrap everything with a macro to reduce file roundtrips (see #2213) -->
{% macro render_nav_item(nav_item, path, level) %} {% macro render(nav_item, path, level) %}
<!-- Determine class according to state --> <!-- Determine class according to state -->
{% set class = "md-nav__item" %} {% set class = "md-nav__item" %}
@ -80,13 +80,8 @@
<ul class="md-nav__list" data-md-scrollfix> <ul class="md-nav__list" data-md-scrollfix>
<!-- Render nested item list --> <!-- Render nested item list -->
{% set base = path %}
{% for nav_item in nav_item.children %} {% for nav_item in nav_item.children %}
{{ render_nav_item( {{ render(nav_item, path ~ "_" ~ loop.index, level + 1) }}
nav_item,
path = base ~ "_" ~ loop.index,
level = level + 1)
}}
{% endfor %} {% endfor %}
</ul> </ul>
</nav> </nav>
@ -141,4 +136,4 @@
{% endmacro %} {% endmacro %}
<!-- Render current and nested navigation items --> <!-- Render current and nested navigation items -->
{{ render_nav_item(nav_item, path, level) }} {{ render(nav_item, path, level) }}