Skip to content

Commit

Permalink
Updated spaceless usage for twig 2/3 (#921)
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish authored Aug 2, 2023
1 parent 05941f1 commit 85d3f86
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
+#}
{% import "@decanter/utilities/macros/menu-loop.twig" as menus %}
<nav {{ attributes }} class="su-secondary-nav no-js {{ modifier_class }}" aria-label="{{ aria_label|default('secondary menu') }}">
{% spaceless %}
{% apply spaceless %}
{% if list_items is iterable %}
{{ menus.nav_menu(list_items, 1, 'su-secondary-nav') }}
{% else %}
{# If custom markup is provided, emit it as is #}
{{ list_items }}
{% endif %}
{% endspaceless %}
{% endapply %}
</nav>
4 changes: 2 additions & 2 deletions core/src/templates/utilities/macros/link-list.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
#}
{% macro link_list(items) %}
{% spaceless %}
{% apply spaceless %}
{% for item in items %}

{# Define the attributes vars fresh on each loop #}
Expand Down Expand Up @@ -42,5 +42,5 @@
<a href="{{ item.href }}" {{ link_attributes }}>{{ item.text }}</a>
</li>
{% endfor %}
{% endspaceless %}
{% endapply %}
{% endmacro %}
4 changes: 2 additions & 2 deletions core/src/templates/utilities/macros/menu-loop.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% macro nav_menu(items, menu_level, class_prefix) %}
{% import _self as menus %}
<ul class="{{ class_prefix }}__menu-lv{{ menu_level }} {{ class_prefix }}__menu">
{% spaceless %}
{% apply spaceless %}
{% for item in items %}
{% set is_parent = item.children is empty ? false : true %}
{% set list_classes = class_prefix ~ "__item " %}
Expand Down Expand Up @@ -36,6 +36,6 @@
{% endif %}
</li>
{% endfor %}
{% endspaceless %}
{% endapply %}
</ul>
{% endmacro %}

0 comments on commit 85d3f86

Please sign in to comment.