From dedea474c875237c8e1bbe9dd90eec2f0bae6ec5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 3 Nov 2019 09:58:35 +0530 Subject: [PATCH] Ignore comments when getting text from serialized html --- src/pyj/read_book/resources.pyj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pyj/read_book/resources.pyj b/src/pyj/read_book/resources.pyj index a8d441a08e..afce0a48a5 100644 --- a/src/pyj/read_book/resources.pyj +++ b/src/pyj/read_book/resources.pyj @@ -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)