Ticket #19237: 19237-1.diff

File 19237-1.diff, 1.4 KB (added by Claude Paroz, 12 years ago)

Updated regex

  • django/utils/html.py

    diff --git a/django/utils/html.py b/django/utils/html.py
    index ec7b28d..a9ebd17 100644
    a b link_target_attribute_re = re.compile(r'(<a [^>]*?)target=[^\s>]+')  
    3333html_gunk_re = re.compile(r'(?:<br clear="all">|<i><\/i>|<b><\/b>|<em><\/em>|<strong><\/strong>|<\/?smallcaps>|<\/?uppercase>)', re.IGNORECASE)
    3434hard_coded_bullets_re = re.compile(r'((?:<p>(?:%s).*?[a-zA-Z].*?</p>\s*)+)' % '|'.join([re.escape(x) for x in DOTS]), re.DOTALL)
    3535trailing_empty_content_re = re.compile(r'(?:<p>(?:&nbsp;|\s|<br \/>)*?</p>\s*)+\Z')
    36 strip_tags_re = re.compile(r'</?\S([^=]*=(\s*"[^"]*"|\s*\'[^\']*\'|\S*)|[^>])*?>', re.IGNORECASE)
     36strip_tags_re = re.compile(r'</?\S([^=>]*=(\s*"[^"]*"|\s*\'[^\']*\'|\S*)|[^>])*?>', re.IGNORECASE)
    3737
    3838
    3939def escape(text):
  • tests/regressiontests/utils/html.py

    diff --git a/tests/regressiontests/utils/html.py b/tests/regressiontests/utils/html.py
    index a0226c4..62c7dac 100644
    a b class TestUtilsHtml(unittest.TestCase):  
    6868            ('a<p onclick="alert(\'<test>\')">b</p>c', 'abc'),
    6969            ('a<p a >b</p>c', 'abc'),
    7070            ('d<a:b c:d>e</p>f', 'def'),
     71            ('<strong>foo</strong><a href="http://example.com">bar</a>', 'foobar'),
    7172        )
    7273        for value, output in items:
    7374            self.check_output(f, value, output)
Back to Top