My JINJA2 template is like below.
{% macro print_if_john(name) -%}
{% if name == 'John' -%}
Hi John
{%- endif %}
{%- endmacro %}
Hello World!
{{print_if_john('Foo')}}
{{print_if_john('Foo2')}}
{{print_if_john('John')}}
The resulting output is
Hello•World!
Hi•John
I don't want the 2 newlines between 'Hello World!' and 'Hi John'. It looks like when a call to macro results in no output from macro, JINJA is inserting a newline anyways.. Is there any way to avoid this? I've put minus in the call to macro itself but that didn't help.
Note that I tested this template and resulting code at http://jinja2test.tk/