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 tempfile import mkdtemp
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
from math import ceil, floor
|
from math import ceil, floor
|
||||||
from PIL import Image as PILImage
|
try:
|
||||||
|
from PIL import Image as PILImage
|
||||||
|
except ImportError:
|
||||||
|
import Image as PILImage
|
||||||
|
|
||||||
from libprs500.lrf.html.BeautifulSoup import BeautifulSoup, Comment, Tag, \
|
from libprs500.lrf.html.BeautifulSoup import BeautifulSoup, Comment, Tag, \
|
||||||
NavigableString, Declaration, ProcessingInstruction
|
NavigableString, Declaration, ProcessingInstruction
|
||||||
@ -424,10 +427,10 @@ class HTMLConverter(object):
|
|||||||
return ''
|
return ''
|
||||||
text = ''
|
text = ''
|
||||||
for c in tag.contents:
|
for c in tag.contents:
|
||||||
if isinstance(c, NavigableString):
|
if isinstance(c, HTMLConverter.IGNORED_TAGS):
|
||||||
text += str(c)
|
|
||||||
elif isinstance(c, Comment):
|
|
||||||
return ''
|
return ''
|
||||||
|
if isinstance(c, NavigableString):
|
||||||
|
text += str(c)
|
||||||
elif isinstance(c, Tag):
|
elif isinstance(c, Tag):
|
||||||
text += self.get_text(c)
|
text += self.get_text(c)
|
||||||
return text
|
return text
|
||||||
|
Loading…
x
Reference in New Issue
Block a user