77

Found some of these in jinja files:

</extension>
{%- else -%}
<extension name="blabla">

And also

{% if freeswitch_dispatcher -%}
<extension name="hold_unhold">

See the dashes ? Any idea what it's for ?

ks1322
  • 33,961
  • 14
  • 109
  • 164
Anto
  • 6,806
  • 8
  • 43
  • 65

2 Answers2

81

Turns out that + and - are there for whitespace control purpose.

You can manually disable the lstrip_blocks behavior by putting a plus sign (+) at the start of a block
[...]
You can also strip whitespace in templates by hand. If you put an minus sign (-) to the start or end of an block (for example a for tag), a comment or variable expression you can remove the whitespaces after or before that block

Anto
  • 6,806
  • 8
  • 43
  • 65
16

It's for controlling whitespace within a block.
{%- by itself means current line should have no empty lines between current and previous line
-%} by itself means current line should have a single empty line above it
{%- and -%} means current line should be flush with previous line

You can experiment here:
http://jinja.quantprogramming.com

Additional links:
Documentation
Credit

theQuestionMan
  • 1,270
  • 2
  • 18
  • 29