From 4f9f0f853a229e41b28fe20f2268f7275e042039 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 26 Oct 2007 17:18:37 +0000 Subject: [PATCH] Fix handling on underlined links and a bug that would cause the same file to be rendered multiple times. --- src/libprs500/ebooks/lrf/html/convert_from.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/libprs500/ebooks/lrf/html/convert_from.py b/src/libprs500/ebooks/lrf/html/convert_from.py index a89bbe04c1..84ae3446c0 100644 --- a/src/libprs500/ebooks/lrf/html/convert_from.py +++ b/src/libprs500/ebooks/lrf/html/convert_from.py @@ -249,11 +249,16 @@ class HTMLConverter(object): update_css(npcss, self.override_pcss) paths = [os.path.normpath(os.path.abspath(path)) for path in paths] - self.base_files = copy.copy(paths) + + while len(paths) > 0 and self.link_level <= self.link_levels: for path in paths: + if path in self.processed_files: + continue try: self.add_file(path) + except KeyboardInterrupt: + raise except: if self.link_level == 0: # Die on errors in the first level raise @@ -487,11 +492,11 @@ class HTMLConverter(object): def create_link(self, children, tag): para = None for i in range(len(children)-1, -1, -1): - if isinstance(children[i], Span): + if isinstance(children[i], (Span, EmpLine)): para = children[i] break if para is None: - raise ConversionError('Failed to parse link %s'%(tag,)) + raise ConversionError('Failed to parse link %s %s'%(tag, children)) text = self.get_text(tag, 1000) if not text: text = 'Link'