Viewer: Fix handling of empty self closing tags. Fixes #1083278 (Private bug)

This commit is contained in:
Kovid Goyal 2012-11-27 13:04:26 +05:30
parent bfe4f5c8b1
commit 10cfd6316f

View File

@ -45,9 +45,7 @@ def load_html(path, view, codec='utf-8', mime_type=None,
html = EntityDeclarationProcessor(html).processed_html
has_svg = re.search(r'<[:a-zA-Z]*svg', html) is not None
if 'xhtml' in mime_type:
self_closing_pat = re.compile(r'<([a-z1-6]+)\s+([^>]+)/>',
re.IGNORECASE)
self_closing_pat = re.compile(r'<([A-Za-z1-6]+)([^>]*)/\s*>')
html = self_closing_pat.sub(self_closing_sub, html)
html = re.sub(ur'<\s*title\s*/\s*>', u'', html, flags=re.IGNORECASE)