From 11b541083cb45ef2393748e17ccf6beeeaafbab5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 6 Dec 2012 08:50:52 +0530 Subject: [PATCH] ... --- src/calibre/ebooks/oeb/transforms/structure.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/oeb/transforms/structure.py b/src/calibre/ebooks/oeb/transforms/structure.py index 3af4d87a13..cd376b4ec4 100644 --- a/src/calibre/ebooks/oeb/transforms/structure.py +++ b/src/calibre/ebooks/oeb/transforms/structure.py @@ -114,7 +114,9 @@ class DetectStructure(object): def find_matches(expr, doc): try: - return XPath(expr)(doc) + ans = XPath(expr)(doc) + len(ans) + return ans except: self.log.warn('Invalid chapter expression, ignoring: %s'%expr) return [] @@ -203,7 +205,9 @@ class DetectStructure(object): def find_matches(expr, doc): try: - return XPath(expr)(doc) + ans = XPath(expr)(doc) + len(ans) + return ans except: self.log.warn('Invalid ToC expression, ignoring: %s'%expr) return []