diff --git a/src/calibre/ebooks/epub/split.py b/src/calibre/ebooks/epub/split.py index 2d815354a3..f4847df578 100644 --- a/src/calibre/ebooks/epub/split.py +++ b/src/calibre/ebooks/epub/split.py @@ -86,11 +86,10 @@ class Splitter(LoggingInterface): root = tree.getroot() # Split large
 tags
         for pre in list(root.xpath('//pre')):
-            text = u''.join(pre.xpath('./text()'))
+            text = u''.join(pre.xpath('descendant::text()'))
             pre.text = text
             for child in list(pre.iterchildren()):
                 pre.remove(child)
-                pre.text += u''.join(child.xpath('./text()'))
             if len(pre.text) > self.opts.profile.flow_size*0.5:
                 frags = self.split_text(pre.text, root, int(0.2*self.opts.profile.flow_size))
                 new_pres = []