mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Handle comments in <a> tags correctly
This commit is contained in:
parent
42e75a1b6b
commit
9d3be321e7
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user