mirror of
https://github.com/django/django.git
synced 2024-12-01 15:42:04 +01:00
Fixed #9883: no longer do strange things with whitespace in the linebreaks filter. Thanks, keithb.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10225 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
02e56530c5
commit
c8ad87c2dc
@ -46,9 +46,9 @@ def linebreaks(value, autoescape=False):
|
||||
value = re.sub(r'\r\n|\r|\n', '\n', force_unicode(value)) # normalize newlines
|
||||
paras = re.split('\n{2,}', value)
|
||||
if autoescape:
|
||||
paras = [u'<p>%s</p>' % escape(p.strip()).replace('\n', '<br />') for p in paras]
|
||||
paras = [u'<p>%s</p>' % escape(p).replace('\n', '<br />') for p in paras]
|
||||
else:
|
||||
paras = [u'<p>%s</p>' % p.strip().replace('\n', '<br />') for p in paras]
|
||||
paras = [u'<p>%s</p>' % p.replace('\n', '<br />') for p in paras]
|
||||
return u'\n\n'.join(paras)
|
||||
linebreaks = allow_lazy(linebreaks, unicode)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user