Handle comments in <a> tags correctly

This commit is contained in:
Kovid Goyal 2007-05-09 21:47:06 +00:00
parent 42e75a1b6b
commit 9d3be321e7

View File

@ -27,7 +27,10 @@ from urlparse import urlparse
from tempfile import mkdtemp
from operator import itemgetter
from math import ceil, floor
try:
from PIL import Image as PILImage
except ImportError:
import Image as PILImage
from libprs500.lrf.html.BeautifulSoup import BeautifulSoup, Comment, Tag, \
NavigableString, Declaration, ProcessingInstruction
@ -424,10 +427,10 @@ class HTMLConverter(object):
return ''
text = ''
for c in tag.contents:
if isinstance(c, HTMLConverter.IGNORED_TAGS):
return ''
if isinstance(c, NavigableString):
text += str(c)
elif isinstance(c, Comment):
return ''
elif isinstance(c, Tag):
text += self.get_text(c)
return text