Skip to content
Myr

[svn] updated the jinja docs for the whitespace stuff

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent 1151fbc · Browse files · 1 file+39 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+39 added−0 removed

  • other:+39 added−0 removed

1 file+39 added−0 removed

modified:docs/src/designerdoc.txt+39 added
648 unmodified lines
649means that they won't raise an error for several releases but yield warnings650on the application side. But it's very unlikely that new keywords will be651added.652653Whitespace654==========655656If the Jinja environment was created with ``trim_blocks`` set to true the657first newline after a template tag is removed automatically (php like658processing).659660Starting with `Jinja 1.1` you can also handle some whitespace rules in the661template. If you put an minus sign (`-`) to the start or end of an block662(for example a `for` tag) or a comment, variable element you can remove663the whitespaces after that block or before that block:664665.. sourcecode:: jinja666667 {% for item in seq -%}668 {{ item }}669 {%- endfor %}670671This will yield all elements without whitespace between them because they672are automatically removed. This of course works for other tags too:673674.. sourcecode:: jinja675676 {% for user in userlist -%}677 {{ user|e -}}678 {% if not loop.last %},{% endif %}679 {%- endfor %}680681Note that you must not use a whitespace between the tag and the minus sign:682683.. sourceode:: jinja684685 valid:686 {%- if foo -%}...{% endif %}687688 invalid:689690 {% - if foo - %}...{% endif %}691692Internationalization693====================694695If the application is configured for i18n, you can define translatable blocks
57 unmodified lines