summaryrefslogtreecommitdiff
path: root/django/utils/html.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-09-04 08:15:09 -0400
committerTim Graham <timograham@gmail.com>2014-09-05 09:22:16 -0400
commit1101467ce0756272a54f4c7bc65c4c335a94111b (patch)
treeddfd451bbc041d69284d3685e351ffc88872780e /django/utils/html.py
parentf8bb8436e533abad563b5235cf0e62e42dbc5f01 (diff)
Limited lines to 119 characters in django/
refs #23395.
Diffstat (limited to 'django/utils/html.py')
-rw-r--r--django/utils/html.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/django/utils/html.py b/django/utils/html.py
index 0ecd48957a..58165ff84c 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -31,16 +31,22 @@ simple_url_re = re.compile(r'^https?://\[?\w', re.IGNORECASE)
simple_url_2_re = re.compile(r'^www\.|^(?!http)\w[^@]+\.(com|edu|gov|int|mil|net|org)($|/.*)$', re.IGNORECASE)
simple_email_re = re.compile(r'^\S+@\S+\.\S+$')
link_target_attribute_re = re.compile(r'(<a [^>]*?)target=[^\s>]+')
-html_gunk_re = re.compile(r'(?:<br clear="all">|<i><\/i>|<b><\/b>|<em><\/em>|<strong><\/strong>|<\/?smallcaps>|<\/?uppercase>)', re.IGNORECASE)
-hard_coded_bullets_re = re.compile(r'((?:<p>(?:%s).*?[a-zA-Z].*?</p>\s*)+)' % '|'.join(re.escape(x) for x in DOTS), re.DOTALL)
+html_gunk_re = re.compile(
+ r'(?:<br clear="all">|<i><\/i>|<b><\/b>|<em><\/em>|<strong><\/strong>|'
+ '<\/?smallcaps>|<\/?uppercase>)', re.IGNORECASE)
+hard_coded_bullets_re = re.compile(
+ r'((?:<p>(?:%s).*?[a-zA-Z].*?</p>\s*)+)' % '|'.join(re.escape(x)
+ for x in DOTS), re.DOTALL)
trailing_empty_content_re = re.compile(r'(?:<p>(?:&nbsp;|\s|<br \/>)*?</p>\s*)+\Z')
def escape(text):
"""
- Returns the given text with ampersands, quotes and angle brackets encoded for use in HTML.
+ Returns the given text with ampersands, quotes and angle brackets encoded
+ for use in HTML.
"""
- return mark_safe(force_text(text).replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;').replace('"', '&quot;').replace("'", '&#39;'))
+ return mark_safe(force_text(text).replace('&', '&amp;').replace('<', '&lt;')
+ .replace('>', '&gt;').replace('"', '&quot;').replace("'", '&#39;'))
escape = allow_lazy(escape, six.text_type)
_js_escapes = {