Skip to content

Commit

Permalink
fix boolean error about whitespace control
Browse files Browse the repository at this point in the history
  • Loading branch information
hvassard authored and davidism committed Dec 18, 2024
1 parent da67299 commit 9c3622c
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions docs/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,27 +202,33 @@ option can also be set to strip tabs and spaces from the beginning of a
line to the start of a block. (Nothing will be stripped if there are
other characters before the start of the block.)

With both `trim_blocks` and `lstrip_blocks` enabled, you can put block tags
on their own lines, and the entire block line will be removed when
rendered, preserving the whitespace of the contents. For example,
without the `trim_blocks` and `lstrip_blocks` options, this template::
With both ``trim_blocks`` and ``lstrip_blocks`` disabled (the default), block
tags on their own lines will be removed, but a blank line will remain and the
spaces in the content will be preserved. For example, this template:

.. code-block:: jinja
<div>
{% if True %}
yay
{% endif %}
</div>
gets rendered with blank lines inside the div::
With both ``trim_blocks`` and ``lstrip_blocks`` disabled, the template is
rendered with blank lines inside the div:

.. code-block:: text
<div>
yay
</div>
But with both `trim_blocks` and `lstrip_blocks` enabled, the template block
lines are removed and other whitespace is preserved::
With both ``trim_blocks`` and ``lstrip_blocks`` enabled, the template block
lines are completely removed:

.. code-block:: text
<div>
yay
Expand Down

0 comments on commit 9c3622c

Please sign in to comment.