mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
E-book viewer: Fix bug in rendering prefixed svg tags in the cover pages of some EPUB files.
This commit is contained in:
parent
9b7846ea41
commit
1c874edd6b
@ -31,7 +31,7 @@ def self_closing_sub(match):
|
||||
return '<%s%s></%s>'%(match.group(1), match.group(2), match.group(1))
|
||||
|
||||
def load_html(path, view, codec='utf-8', mime_type=None,
|
||||
pre_load_callback=lambda x:None, path_is_html=False,
|
||||
pre_load_callback=lambda x:None, path_is_html=False,
|
||||
force_as_html=False):
|
||||
from PyQt4.Qt import QUrl, QByteArray
|
||||
if mime_type is None:
|
||||
@ -45,7 +45,7 @@ def load_html(path, view, codec='utf-8', mime_type=None,
|
||||
html = f.read().decode(codec, 'replace')
|
||||
|
||||
html = EntityDeclarationProcessor(html).processed_html
|
||||
self_closing_pat = re.compile(r'<\s*([A-Za-z1-6]+)([^>]*)/\s*>')
|
||||
self_closing_pat = re.compile(r'<\s*([:A-Za-z1-6]+)([^>]*)/\s*>')
|
||||
html = self_closing_pat.sub(self_closing_sub, html)
|
||||
|
||||
loading_url = QUrl.fromLocalFile(path)
|
||||
|
@ -790,8 +790,7 @@ class DocumentView(QWebView): # {{{
|
||||
self.manager.load_started()
|
||||
|
||||
load_html(path, self, codec=getattr(path, 'encoding', 'utf-8'), mime_type=getattr(path,
|
||||
'mime_type', 'text/html'), pre_load_callback=callback,
|
||||
force_as_html=True)
|
||||
'mime_type', 'text/html'), pre_load_callback=callback)
|
||||
entries = set()
|
||||
for ie in getattr(path, 'index_entries', []):
|
||||
if ie.start_anchor:
|
||||
|
Loading…
x
Reference in New Issue
Block a user