Open prior opened 6 years ago
I have a similar problem with new lines.
Some templates have for loops and if statements, and they always render a line in the output. Is possible to not render a new line when we have a line, exclusively, with for, endfor, if or endif (at least)?
@AnakinPt Do you have an example snippet I could use to see what is going on?
Original template:
Resources:
{% for n in bucketList %}
{{ n.resourceName }}:
Type: 'AWS::S3::Bucket'
Properties:
Generated:
Resources:
LoggingS3Bucket:
Type: 'AWS::S3::Bucket'
Properties:
If you see in the previous code it generates an empty line in the line with the {% for %} loop?
You can use
{%- for n in bucketList -%}
to strip whitespace.
Thanks. I'll try it next week.
worked perfectly, but only with the dash in the beginning. The both will strip other space.
example template that reveals error:
I would expect output to be: (as confirmed by http://jinja2test.tk/ )
but instead jinjava outputs: