From 3697256c45f4b85cda3fe43506a97d4dcbd2326a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 23 Feb 2012 13:42:48 +0530 Subject: [PATCH] ... --- src/calibre/ebooks/mobi/writer2/serializer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/mobi/writer2/serializer.py b/src/calibre/ebooks/mobi/writer2/serializer.py index abcd68673e..abce926152 100644 --- a/src/calibre/ebooks/mobi/writer2/serializer.py +++ b/src/calibre/ebooks/mobi/writer2/serializer.py @@ -307,8 +307,8 @@ class Serializer(object): 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 + # Only set this id_offset if it wasn't previously seen + self.id_offsets[key] = self.id_offsets.get(key, offset) if self.anchor_offset is not None and \ tag == 'a' and not elem.attrib and \ not len(elem) and not elem.text: