From 66e03c98e39d8e7ac75a64eaa7a3467f51de830e Mon Sep 17 00:00:00 2001 From: Kiryl Date: Thu, 23 Jun 2022 18:48:50 +0300 Subject: [PATCH] Add style to tags without --- src/epub_converter/html_epub_preprocessor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/epub_converter/html_epub_preprocessor.py b/src/epub_converter/html_epub_preprocessor.py index 627d1f1..9f776c3 100644 --- a/src/epub_converter/html_epub_preprocessor.py +++ b/src/epub_converter/html_epub_preprocessor.py @@ -209,7 +209,7 @@ def _preprocess_code_tags(chapter_tag: BeautifulSoup): """ Function - transform , , tags into span - - add code style to this tags + - add code style to this tags (if there is no) Parameters ---------- chapter_tag: Tag, soup object @@ -222,10 +222,10 @@ def _preprocess_code_tags(chapter_tag: BeautifulSoup): for code in chapter_tag.find_all(re.compile("code|kbd|var")): if not code.parent.name == "pre": code.name = "span" + if not code.attrs.get("style"): + code.attrs["style"] = "font-size: 14px; font-family: courier new,courier,monospace;" continue - # if tag isn"t in pre and doesn"t have style - if not code.attrs.get("style"): - code.attrs["style"] = "font-size: 14px; font-family: courier new,courier,monospace;" + def _preprocess_pre_tags(chapter_tag: BeautifulSoup):