IGN:Fix bug in anchor insertion routine where it was inserting an anchor in the wrong place

This commit is contained in:
Kovid Goyal 2009-04-25 09:23:44 -07:00
parent 0140831b53
commit 54dd263be1

View File

@ -587,7 +587,8 @@ class MobiReader(object):
if r > -1 and (r < l or l == end or l == -1): if r > -1 and (r < l or l == end or l == -1):
p = self.mobi_html.rfind('<', 0, end + 1) p = self.mobi_html.rfind('<', 0, end + 1)
if pos < end and p > -1 and \ if pos < end and p > -1 and \
not end_tag_re.match(self.mobi_html[p:r]): not end_tag_re.match(self.mobi_html[p:r]) and \
not self.mobi_html[p:r+1].endswith('/>'):
anchor = ' filepos-id="filepos%d"' anchor = ' filepos-id="filepos%d"'
end = r end = r
else: else: