Is it possible to have something compact without space between these two lines:
foo_content:
blabla {% if var1 | default() %} {{ var1 | join(’ ‘) }}{% endif %}
{% if var2 | default() %} {{ var2 | join(’ ') }}{% endif %}
You’re going to be disappointed I’m afraid.
You can get something that looks okay at first glance by adding a + before the last %} on each endif. That preserves the new-line which would normally be deleted after a block command. So
Or this more general approach which produces the same result as the previous example:
foo_content: |
blabla
{% for v in [var1, var9, var8, var2] %}
{% if v | default([]) %}
{{ v | join(' ') }}
{% endif %}
{% endfor %}
bling
This kind of answer is one that I’m particularly unhappy with.
User: I want to do X because <whatever>. How can I do X?
Help: Do Y instead!
User: But I want to do X.
Help: Yeah, me too. X won’t work. Do Y instead.
User: But…
Help: I know. (Do Y instead.)