Skip to content
Myr

Merge pull request #343 from joernhees/patch-1

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

Custom Filters example inserts escaped <br>s

authored by Markus Unterwaditzer · committed by Markus Unterwaditzer · parents 6363243, 1702451 · Browse files · 1 file+1 added−1 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+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:docs/api.rst+1 added-1 removed
605 unmodified lines
606 _paragraph_re = re.compile(r'(?:\r\n|\r|\n){2,}')607608 @evalcontextfilter609 def nl2br(eval_ctx, value):610 result = u'\n\n'.join(u'<p>%s</p>' % p.replace('\n', '<br>\n')610 result = u'\n\n'.join(u'<p>%s</p>' % p.replace('\n', Markup('<br>\n'))611 for p in _paragraph_re.split(escape(value)))612 if eval_ctx.autoescape:613 result = Markup(result)614 return result
181 unmodified lines