Preserve all line breaks in literal blocks

Fixes #8512
This commit is contained in:
James Cammarata 2014-08-08 11:54:38 -05:00
parent 039e4571b9
commit 63bf2f6d9a
4 changed files with 35 additions and 12 deletions

View file

@ -705,9 +705,9 @@ class TestUtils(unittest.TestCase):
# jinja2 loop blocks with lots of complexity
_test_combo(
# in memory of neighbors cat
# we only preserve newlines inside of quotes
'a {% if x %} y {%else %} {{meow}} {% endif %} "cookie\nchip"\ndone',
['a', '{% if x %}', 'y', '{%else %}', '{{meow}}', '{% endif %}', '"cookie\nchip"', 'done']
# we preserve line breaks unless a line continuation character preceeds them
'a {% if x %} y {%else %} {{meow}} {% endif %} "cookie\nchip" \\\ndone\nand done',
['a', '{% if x %}', 'y', '{%else %}', '{{meow}}', '{% endif %}', '"cookie\nchip"', 'done', '\nand', 'done']
)
# test space preservation within quotes