From e685f4f79d1b6e22885da17d19755d52514fec9b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 18 Mar 2009 10:13:53 -0700 Subject: [PATCH] Fix #2098 (PRS-505 stating "Page Error!" when trying to open an ePub file) --- src/calibre/ebooks/epub/split.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/epub/split.py b/src/calibre/ebooks/epub/split.py index 9814c40df5..da97fa6586 100644 --- a/src/calibre/ebooks/epub/split.py +++ b/src/calibre/ebooks/epub/split.py @@ -139,7 +139,9 @@ class Splitter(LoggingInterface): split_point, before = self.find_split_point(root) if split_point is None or self.split_size > 6*self.orig_size: if not self.always_remove: - self.log_warn(_('\t\tToo much markup. Re-splitting without structure preservation. This may cause incorrect rendering.')) + self.log_warn(_('\t\tToo much markup. Re-splitting without ' + 'structure preservation. This may cause ' + 'incorrect rendering.')) raise SplitError(self.path, root) for t in self.do_split(tree, split_point, before): @@ -150,7 +152,8 @@ class Splitter(LoggingInterface): if size <= self.opts.profile.flow_size: self.trees.append(t) #print tostring(t.getroot(), pretty_print=True) - self.log_debug('\t\t\tCommitted sub-tree #%d (%d KB)', len(self.trees), size/1024.) + self.log_debug('\t\t\tCommitted sub-tree #%d (%d KB)', + len(self.trees), size/1024.) self.split_size += size else: self.split_to_size(t) @@ -332,8 +335,10 @@ class Splitter(LoggingInterface): '//p', '//br', '//li', + '//div', ): - elems = root.xpath(path, namespaces={'re':'http://exslt.org/regular-expressions'}) + elems = root.xpath(path, + namespaces={'re':'http://exslt.org/regular-expressions'}) elem = pick_elem(elems) if elem is not None: try: