From b900419810e8d6fd9510f259e3b2dbab82739ece Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 15 Sep 2019 04:34:23 +0530 Subject: [PATCH] Micro optimization --- src/calibre/library/comments.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/library/comments.py b/src/calibre/library/comments.py index 952cbeb79d..344dd99873 100644 --- a/src/calibre/library/comments.py +++ b/src/calibre/library/comments.py @@ -95,6 +95,7 @@ def comments_to_html(comments): open_pTag = False all_tokens = list(soup.contents) + inline_tags = ('br', 'b', 'i', 'em', 'strong', 'span', 'font', 'a', 'hr') for token in all_tokens: if isinstance(token, (CData, Comment, Declaration, ProcessingInstruction)): continue @@ -105,8 +106,7 @@ def comments_to_html(comments): ptc = 0 pTag.insert(ptc, token) ptc += 1 - elif token.name in ['br', 'b', 'i', 'em', 'strong', 'span', 'font', 'a', - 'hr']: + elif token.name in inline_tags: if not open_pTag: pTag = result.new_tag('p') open_pTag = True