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:
Kovid Goyal 2014-03-06 21:47:43 +05:30
parent 20dd82d501
commit bdb2d0a5d9

View File

@ -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