diff --git a/src/epub_converter/html_epub_preprocessor.py b/src/epub_converter/html_epub_preprocessor.py index 6944caf..ed90767 100644 --- a/src/epub_converter/html_epub_preprocessor.py +++ b/src/epub_converter/html_epub_preprocessor.py @@ -62,7 +62,6 @@ def process_structural_tags(chapter_tag: BeautifulSoup) -> BeautifulSoup: """Function to replace all tags to correspond livecarta tags""" for reg_key, to_replace_value in LiveCartaConfig.REPLACE_REGEX_WITH_LIVECARTA_CORRESPOND_TAGS.items(): for key in reg_key: - # text = tag if isinstance(tag, NavigableString) else tag.text tags = chapter_tag.find_all(re.compile(key)) for tag in tags: tag.name = to_replace_value @@ -83,6 +82,12 @@ def process_structural_tags(chapter_tag: BeautifulSoup) -> BeautifulSoup: while mark.parent != chapter_tag: mark.parent.unwrap() # todo warning! could reflect on formatting/internal links in some cases + # 1. remove comments + _remove_comments(chapter_tag) + + # 2. wrap NavigableString with tag
+ _wrap_strings_with_p(chapter_tag)
+
_tags_to_correspond_livecarta_tag(chapter_tag)
_unwrap_tags(chapter_tag)
@@ -294,7 +299,6 @@ def _preprocess_pre_tags(chapter_tag: BeautifulSoup):
pre.append(code)
-# todo replace
def _wrap_tag_with_table(chapter_tag, tag_to_be_wrapped, width="100", border="", bg_color=None):
"""Function wraps
- _wrap_strings_with_p(content_tag)
# 3. heading removal
if remove_title_from_chapter:
"""
table = chapter_tag.new_tag("table")
@@ -386,11 +390,7 @@ def prepare_content(title_str: str, content_tag: BeautifulSoup, remove_title_fro
prepared content
"""
- # 1. remove comments
- _remove_comments(content_tag)
- # 2. wrap NavigableString with tag