From ab0c2accef65b9333482c42ad48b19e202c86c19 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 14 Jan 2009 00:08:42 -0800 Subject: [PATCH] LRF Output:Improve extraction of text from tags for TOC entries and anchors. Fixes #1613 (Converting MS Lit to Lrf problems) --- src/calibre/ebooks/lrf/html/convert_from.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/calibre/ebooks/lrf/html/convert_from.py b/src/calibre/ebooks/lrf/html/convert_from.py index ab8550bd5e..e884ea7213 100644 --- a/src/calibre/ebooks/lrf/html/convert_from.py +++ b/src/calibre/ebooks/lrf/html/convert_from.py @@ -580,20 +580,20 @@ class HTMLConverter(object, LoggingInterface): if (css.has_key('display') and css['display'].lower() == 'none') or \ (css.has_key('visibility') and css['visibility'].lower() == 'hidden'): return '' - text = u'' + text, alt_text = u'', u'' for c in tag.contents: if limit != None and len(text) > limit: break if isinstance(c, HTMLConverter.IGNORED_TAGS): - return u'' + continue if isinstance(c, NavigableString): text += unicode(c) elif isinstance(c, Tag): if c.name.lower() == 'img' and c.has_key('alt'): - text += c['alt'] - return text + alt_text += c['alt'] + continue text += self.get_text(c) - return text + return text if text.strip() else alt_text def process_links(self): def add_toc_entry(text, target):