mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
MOBI Input: Fix empty <a> tags not being handled correctly in rare cases when the markup is bad enough to be parsed only using the HTML 5 algorithm. Fixes #1288430 [Private bug](https://bugs.launchpad.net/calibre/+bug/1288430)
This commit is contained in:
parent
20dd82d501
commit
bdb2d0a5d9
@ -50,10 +50,13 @@ class MOBIInput(InputFormatPlugin):
|
||||
if isinstance(raw, unicode):
|
||||
raw = raw.encode('utf-8')
|
||||
open(u'debug-raw.html', 'wb').write(raw)
|
||||
from calibre.ebooks.oeb.base import close_self_closing_tags
|
||||
for f, root in parse_cache.items():
|
||||
raw = html.tostring(root, encoding='utf-8', method='xml',
|
||||
include_meta_content_type=False)
|
||||
raw = close_self_closing_tags(raw)
|
||||
with open(f, 'wb') as q:
|
||||
q.write(html.tostring(root, encoding='utf-8', method='xml',
|
||||
include_meta_content_type=False))
|
||||
q.write(raw)
|
||||
accelerators['pagebreaks'] = '//h:div[@class="mbp_pagebreak"]'
|
||||
return mr.created_opf_path
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user