mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
This commit is contained in:
parent
674ff88942
commit
1bff449a4c
@ -539,24 +539,24 @@ class HTMLConverter(object):
|
|||||||
|
|
||||||
|
|
||||||
def get_text(self, tag, limit=None):
|
def get_text(self, tag, limit=None):
|
||||||
css = self.tag_css(tag)[0]
|
css = self.tag_css(tag)[0]
|
||||||
if (css.has_key('display') and css['display'].lower() == 'none') or \
|
if (css.has_key('display') and css['display'].lower() == 'none') or \
|
||||||
(css.has_key('visibility') and css['visibility'].lower() == 'hidden'):
|
(css.has_key('visibility') and css['visibility'].lower() == 'hidden'):
|
||||||
return ''
|
return ''
|
||||||
text = u''
|
text = u''
|
||||||
for c in tag.contents:
|
for c in tag.contents:
|
||||||
if limit != None and len(text) > limit:
|
if limit != None and len(text) > limit:
|
||||||
break
|
break
|
||||||
if isinstance(c, HTMLConverter.IGNORED_TAGS):
|
if isinstance(c, HTMLConverter.IGNORED_TAGS):
|
||||||
return u''
|
return u''
|
||||||
if isinstance(c, NavigableString):
|
if isinstance(c, NavigableString):
|
||||||
text += unicode(c)
|
text += unicode(c)
|
||||||
elif isinstance(c, Tag):
|
elif isinstance(c, Tag):
|
||||||
if c.name.lower() == 'img' and c.has_key('alt'):
|
if c.name.lower() == 'img' and c.has_key('alt'):
|
||||||
text += c['alt']
|
text += c['alt']
|
||||||
return text
|
return text
|
||||||
text += self.get_text(c)
|
text += self.get_text(c)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def process_links(self):
|
def process_links(self):
|
||||||
def add_toc_entry(text, target):
|
def add_toc_entry(text, target):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user