MOBI Output: When the same anchor is present more than once in the input document, use the first occurence rather than the last one. Fixes #934031 (link destination is wrong in case of html -> mobi conversion)

This commit is contained in:
Kovid Goyal 2012-02-23 13:32:25 +05:30
parent 1b5d0a6038
commit 1249a15570

View File

@ -306,6 +306,8 @@ class Serializer(object):
if id_:
href = '#'.join((item.href, id_))
offset = self.anchor_offset or buf.tell()
key = urlnormalize(href)
if key not in self.id_offsets:
self.id_offsets[urlnormalize(href)] = offset
if self.anchor_offset is not None and \
tag == 'a' and not elem.attrib and \