diff options
| author | Jannis Leidel <jannis@leidel.info> | 2011-07-29 10:22:25 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2011-07-29 10:22:25 +0000 |
| commit | 343b4f1ea5ffc48c03138640a85a1781ccbf2964 (patch) | |
| tree | 3e1307d11e633e5f63a9494ad83503e21f51d599 /django/utils/html.py | |
| parent | 0fbadfd1c8ce30fd4c9f2857d467047d5bfac63d (diff) | |
Fixed #14288 -- Fixed linebreaksbr template filter to normalize newlines first. Thanks, Julien Phalip.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16573 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils/html.py')
| -rw-r--r-- | django/utils/html.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/utils/html.py b/django/utils/html.py index 7fda015840..2687eb5232 100644 --- a/django/utils/html.py +++ b/django/utils/html.py @@ -7,6 +7,7 @@ from django.utils.safestring import SafeData, mark_safe from django.utils.encoding import force_unicode from django.utils.functional import allow_lazy from django.utils.http import urlquote +from django.utils.text import normalize_newlines # Configuration for urlize() function. LEADING_PUNCTUATION = ['(', '<', '<'] @@ -70,7 +71,7 @@ def conditional_escape(html): def linebreaks(value, autoescape=False): """Converts newlines into <p> and <br />s.""" - value = re.sub(r'\r\n|\r|\n', '\n', force_unicode(value)) # normalize newlines + value = normalize_newlines(value) paras = re.split('\n{2,}', value) if autoescape: paras = [u'<p>%s</p>' % escape(p).replace('\n', '<br />') for p in paras] |
