diff options
author | Kristi Tsukida <kristi.dev@gmail.com> | 2012-07-12 13:44:54 -0700 |
---|---|---|
committer | Kristi Tsukida <kristi.dev@gmail.com> | 2012-07-12 13:44:54 -0700 |
commit | e4a74f9b9b76fc841e431123d91abcb5259ac747 (patch) | |
tree | d7e92343abe1d76c89f6e42abeb16a982531c285 /docs | |
parent | 523efbdf6145f0b39eb03add87ab515f3e184b24 (diff) | |
download | jinja2-e4a74f9b9b76fc841e431123d91abcb5259ac747.tar.gz |
Document the {%+ manual disable lstrip_blocks feature
Diffstat (limited to 'docs')
-rw-r--r-- | docs/templates.rst | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/docs/templates.rst b/docs/templates.rst index ff7d5f7..c1ae657 100644 --- a/docs/templates.rst +++ b/docs/templates.rst @@ -180,12 +180,20 @@ gets rendered with blank lines inside the div:: </div> -But with both `trim_blocks` and `lstrip_blocks` enabled, the lines with the template blocks are removed while preserving the whitespace of the contents:: +But with both `trim_blocks` and `lstrip_blocks` enabled, the lines with the +template blocks are removed while preserving the whitespace of the contents:: <div> yay </div> +You can manually disable the `lstrip_blocks` behavior by putting a +plus sign (``+``) at the start of a block:: + + <div> + {%+ if something %}yay{% endif %} + </div> + 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 |