mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
DOCX: Handle redundant bookmarks
DOCX Input: Fix links pointing to locations in the same document that contain multiple, redundant bookmarks not working.
This commit is contained in:
parent
bbaf2ff574
commit
c8c3741d34
@ -342,7 +342,13 @@ class Convert(object):
|
||||
elif x.tag.endswith('}bookmarkStart'):
|
||||
anchor = get(x, 'w:name')
|
||||
if anchor and anchor not in self.anchor_map:
|
||||
old_anchor = current_anchor
|
||||
self.anchor_map[anchor] = current_anchor = generate_anchor(anchor, frozenset(self.anchor_map.itervalues()))
|
||||
if old_anchor is not None:
|
||||
# The previous anchor was not applied to any element
|
||||
for a, t in tuple(self.anchor_map.iteritems()):
|
||||
if t == old_anchor:
|
||||
self.anchor_map[a] = current_anchor
|
||||
elif x.tag.endswith('}hyperlink'):
|
||||
current_hyperlink = x
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user