From 01c2c8b120b381349f3fc92097181ada0af5d64c Mon Sep 17 00:00:00 2001
From: Kiryl ...
\n
...
\n
(section) - tag.name = to_replace_value + for reg_keys, to_replace_value in LiveCartaConfig.REPLACE_TAG_WITH_LIVECARTA_CORRESPOND_TAGS.items(): + for key in reg_keys: + if isinstance(key, tuple): + replace = key[0] + parent, child = key[1], key[2] + for parent_tag in chapter_tag.select(parent): + if replace == "parent": + parent_tag.name = to_replace_value + elif replace == "child": + for child_tag in parent_tag.select(child): + child_tag.name = to_replace_value + if not child_tag.attrs.get("style"): + child_tag.attrs["style"] =\ + "font-size: 14px; font-family: courier new,courier,monospace;" + else: + tags = chapter_tag.find_all(re.compile(key)) + for tag in tags: + # todo can cause appearance of \n...
->\n
...
\n
(section) + tag.name = to_replace_value def _unwrap_tags(chapter_tag):