MOBI Input: Fix links not working in viewer for MOBI files that contain anchors placed on linebreak elements. Fixes #1439450 [Private bug](https://bugs.launchpad.net/calibre/+bug/1439450)

This commit is contained in:
Kovid Goyal 2015-04-02 09:21:00 +05:30
parent 9919a1f4c0
commit 57a8c0e8a5

View File

@ -385,8 +385,7 @@ class MobiReader(object):
svg_tags = []
forwardable_anchors = []
pagebreak_anchors = []
BLOCK_TAGS = {'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
'div', 'p'}
BLOCK_TAGS = {'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'p'}
for i, tag in enumerate(root.iter(etree.Element)):
tag.attrib.pop('xmlns', '')
for x in tag.attrib:
@ -583,6 +582,10 @@ class MobiReader(object):
else:
block.attrib['id'] = tag.attrib['id']
# WebKit fails to navigate to anchors located on <br> tags
for br in root.xpath('/body/br[@id]'):
br.tag = 'div'
def get_left_whitespace(self, tag):
def whitespace(tag):