Handle <img> in <a href> tags

This commit is contained in:
Kovid Goyal 2007-05-12 21:34:26 +00:00
parent a29bf8eea0
commit b2a301912f

View File

@ -502,6 +502,14 @@ class HTMLConverter(object):
for link in self.links: for link in self.links:
para, tag = link.para, link.tag para, tag = link.para, link.tag
text = self.get_text(tag) text = self.get_text(tag)
if not text:
text = 'Link'
img = tag.find('img')
if img:
try:
text = img['alt']
except KeyError:
pass
if self.hide_broken_links: if self.hide_broken_links:
para.contents = [] para.contents = []
para.append(_Span(text=text)) para.append(_Span(text=text))