Fix handling on underlined links and a bug that would cause the same file to be rendered multiple times.

This commit is contained in:
Kovid Goyal 2007-10-26 17:18:37 +00:00
parent 4016318029
commit 4f9f0f853a

View File

@ -249,11 +249,16 @@ class HTMLConverter(object):
update_css(npcss, self.override_pcss) update_css(npcss, self.override_pcss)
paths = [os.path.normpath(os.path.abspath(path)) for path in paths] 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: while len(paths) > 0 and self.link_level <= self.link_levels:
for path in paths: for path in paths:
if path in self.processed_files:
continue
try: try:
self.add_file(path) self.add_file(path)
except KeyboardInterrupt:
raise
except: except:
if self.link_level == 0: # Die on errors in the first level if self.link_level == 0: # Die on errors in the first level
raise raise
@ -487,11 +492,11 @@ class HTMLConverter(object):
def create_link(self, children, tag): def create_link(self, children, tag):
para = None para = None
for i in range(len(children)-1, -1, -1): for i in range(len(children)-1, -1, -1):
if isinstance(children[i], Span): if isinstance(children[i], (Span, EmpLine)):
para = children[i] para = children[i]
break break
if para is None: 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) text = self.get_text(tag, 1000)
if not text: if not text:
text = 'Link' text = 'Link'