mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Ignore comments when getting text from serialized html
This commit is contained in:
parent
47d3d16978
commit
dedea474c8
@ -401,7 +401,7 @@ def text_from_serialized_html(data):
|
||||
for child in serialized_data.tree.c:
|
||||
if child.n is 'body':
|
||||
stack.push(child)
|
||||
ignore_text = {'script':True, 'style':True}
|
||||
ignore_text = {'script':True, 'style':True, 'title': True}
|
||||
while stack.length:
|
||||
node = stack.pop()
|
||||
if jstype(node) is 'string':
|
||||
@ -411,7 +411,7 @@ def text_from_serialized_html(data):
|
||||
src = tag_map[node[0]]
|
||||
else:
|
||||
src = node
|
||||
if not ignore_text[src.n] and src.x:
|
||||
if src.n and not ignore_text[src.n] and src.x:
|
||||
ans.push(src.x)
|
||||
if src.l:
|
||||
stack.push(src.l)
|
||||
|
Loading…
x
Reference in New Issue
Block a user