diff options
| author | Tim Graham <timograham@gmail.com> | 2014-09-04 08:15:09 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-09-05 09:22:16 -0400 |
| commit | 1101467ce0756272a54f4c7bc65c4c335a94111b (patch) | |
| tree | ddfd451bbc041d69284d3685e351ffc88872780e /django/utils/html.py | |
| parent | f8bb8436e533abad563b5235cf0e62e42dbc5f01 (diff) | |
Limited lines to 119 characters in django/
refs #23395.
Diffstat (limited to 'django/utils/html.py')
| -rw-r--r-- | django/utils/html.py | 14 |
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>(?: |\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('&', '&').replace('<', '<').replace('>', '>').replace('"', '"').replace("'", ''')) + return mark_safe(force_text(text).replace('&', '&').replace('<', '<') + .replace('>', '>').replace('"', '"').replace("'", ''')) escape = allow_lazy(escape, six.text_type) _js_escapes = { |
