mirror of https://github.com/django/django.git
Partially revert 9efe1a721
, strip_tags improvements
The new regex seems not stable enough for being released. Stripping with regex might need reevaluation for the next release. Refs #19237.
This commit is contained in:
parent
3b952123ac
commit
20ac33100c
|
@ -33,7 +33,7 @@ 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)
|
||||
trailing_empty_content_re = re.compile(r'(?:<p>(?: |\s|<br \/>)*?</p>\s*)+\Z')
|
||||
strip_tags_re = re.compile(r'</?\S([^=]*=(\s*"[^"]*"|\s*\'[^\']*\'|\S*)|[^>])*?>', re.IGNORECASE)
|
||||
strip_tags_re = re.compile(r'<[^>]*?>', re.IGNORECASE)
|
||||
|
||||
|
||||
def escape(text):
|
||||
|
|
|
@ -65,7 +65,6 @@ class TestUtilsHtml(unittest.TestCase):
|
|||
('<f', '<f'),
|
||||
('</fe', '</fe'),
|
||||
('<x>b<y>', 'b'),
|
||||
('a<p onclick="alert(\'<test>\')">b</p>c', 'abc'),
|
||||
('a<p a >b</p>c', 'abc'),
|
||||
('d<a:b c:d>e</p>f', 'def'),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue