mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user