1

I read document says the format for jinja2 for loop and macro are as below

{% for my_item in my_collection %}
{% endfor %}

{% macro macro_name(arg1, arg2) %} 
{% endmacro %}

But when I read someone's code, there always have a dash(-) next to the %. like

{% for my_item in my_collection -%}
{% endfor -%}

{%- macro macro_name(arg1, arg2) -%} 
{%- endmacro -%}

Is there a reason for the dash or it is purely cosmatic and can be ignored?

chun xu
  • 393
  • 1
  • 4
  • 13
  • 1
    Does this answer your question? [Remove unnecessary whitespace from Jinja rendered template](https://stackoverflow.com/questions/35775207/remove-unnecessary-whitespace-from-jinja-rendered-template) – β.εηοιτ.βε Apr 27 '23 at 10:57
  • 2
    Does this answer your question? [Dashes in jinja templates](https://stackoverflow.com/questions/19401106/dashes-in-jinja-templates) – Tsyvarev Apr 27 '23 at 16:34

0 Answers0