From f315b1cacb931447cf1b45471f7de4a06d40b3bb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 15 Jun 2016 23:03:43 +0530 Subject: [PATCH] ... --- src/calibre/ebooks/oeb/polish/toc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/polish/toc.py b/src/calibre/ebooks/oeb/polish/toc.py index 0376d7e1b3..75dd0dbc48 100644 --- a/src/calibre/ebooks/oeb/polish/toc.py +++ b/src/calibre/ebooks/oeb/polish/toc.py @@ -157,7 +157,7 @@ def parse_ncx(container, ncx_name): def add_from_li(container, li, parent, nav_name): dest = frag = text = None for x in li.iterchildren(XHTML('a'), XHTML('span')): - text = etree.tostring(x, method='text', encoding=unicode, with_tail=False) or ' '.join('descendant-or-self::*/@title') + text = etree.tostring(x, method='text', encoding=unicode, with_tail=False).strip() or ' '.join(x.xpath('descendant-or-self::*/@title')).strip() href = x.get('href') if href: dest = nav_name if href.startswith('#') else container.href_to_name(href, base=nav_name)