From 21971d0e25b5e68e121c18dc6c964dd785e18993 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 28 Jan 2014 09:51:03 +0530 Subject: [PATCH] EPUB Output: Fix splitting of HTML files not updating links in the section of the NCX file --- src/calibre/ebooks/oeb/transforms/split.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/calibre/ebooks/oeb/transforms/split.py b/src/calibre/ebooks/oeb/transforms/split.py index 02215c5121..60d036a369 100644 --- a/src/calibre/ebooks/oeb/transforms/split.py +++ b/src/calibre/ebooks/oeb/transforms/split.py @@ -467,4 +467,13 @@ class FlowSplitter(object): if self.oeb.toc: fix_toc_entry(self.oeb.toc) + if self.oeb.pages: + for page in self.oeb.pages: + href, frag = urldefrag(page.href) + if href == self.item.href: + nhref = self.anchor_map[frag if frag else None] + if frag: + nhref = '#'.join((nhref, frag)) + page.href = nhref + self.oeb.manifest.remove(self.item)