forked from LiveCarta/BookConverter
Add style to <code> tags without
This commit is contained in:
@@ -209,7 +209,7 @@ def _preprocess_code_tags(chapter_tag: BeautifulSoup):
|
||||
"""
|
||||
Function
|
||||
- transform <code>, <kdb>, <var> 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):
|
||||
|
||||
Reference in New Issue
Block a user