Extra newline at end of output #2112
Replies: 2 comments 2 replies
-
https://jinja.palletsprojects.com/en/stable/templates/#whitespace-control You need to use whitespace control marks on the tags as well. There is a newline between the content and end tag. |
Beta Was this translation helpful? Give feedback.
-
I think that what is happening is that Salt (which is what I'm using Jinja in) is adding a final newline because Their fix works as intended when a template ends with content, but not when the last line is a Jinja block. I'll open an issue with Salt to remove the fix and use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Even with
trim_blocks=True
andlstrip_blocks=True
, a template like this will result in not one, but two newlines at the end of the generated output:With
lines = ['a', 'b', 'c']
, this will generate:I'd expect the output to end with a single newline instead of two.
If there is content after
{% endfor %}
, no additional newline will be generated, so this template:will generate this output, which is what I'd expect:
Environment:
Beta Was this translation helpful? Give feedback.
All reactions