Skip to content
Myr

Merge pull request #929 from ExplodingCabbage/fix-nl2br

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

Fix broken nl2br filter example

authored by David Lord · committed by GitHub · parents a7f1f52, 9e410c7 · 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
738 unmodified lines
739740 import re741 from jinja2 import evalcontextfilter, Markup, escape742743 _paragraph_re = re.compile(r'(?:\r\n|\r|\n){2,}')743 _paragraph_re = re.compile(r'(?:\r\n|\r(?!\n)|\n){2,}')744745 @evalcontextfilter746 def nl2br(eval_ctx, value):747 result = u'\n\n'.join(u'<p>%s</p>' % p.replace('\n', Markup('<br>\n'))
185 unmodified lines