Skip to content
Myr

Apply unesacpe fix when blank is True

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

authored by Erik Johnson · committed by Erik Johnson · parent 50995cb · Browse files · 1 file+13 added−7 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+13 added−7 removed

  • other:+13 added−7 removed

1 file+13 added−7 removed

modified:jinja2/filters.py+13 added-7 removed
555 unmodified lines
556557 s += u'\n' # this quirk is necessary for splitlines method558 indention = u' ' * width559560 def _unescape(val):561 '''562 Unescape any strings that were escaped due to concatenation. If the563 value passed is not a Markup instance, return the original value.564 '''565 try:566 return Markup(val.unescape())567 except AttributeError:568 # s was not a Markup instance569 return val570571 if blank:561 rv = (u'\n' + indention).join(s.splitlines())572 rv = _unescape((u'\n' + indention).join(s.splitlines()))573 else:574 lines = s.splitlines()575 rv = lines.pop(0)576577 if lines:578 rv += u'\n' + u'\n'.join(579 indention + line if line else line for line in lines580 )570 try:571 # Unescape any strings that were escaped due to concatenation572 rv = Markup(rv.unescape())573 except AttributeError:574 # s was not a Markup instance575 pass581 rv = _unescape(rv)582583 if first:584 rv = indention + rv585
617 unmodified lines