forked from LiveCarta/BookConverter
Add ability to unwrap tags that are in certain tags
This commit is contained in:
@@ -165,10 +165,14 @@ def _tags_to_correspond_livecarta_tag(chapter_tag):
|
||||
|
||||
def _unwrap_tags(chapter_tag):
|
||||
"""Function unwrap tags and move id to span"""
|
||||
for tag in LiveCartaConfig.TAGS_TO_UNWRAP:
|
||||
for s in chapter_tag.find_all(tag):
|
||||
_add_span_to_save_ids_for_links(s, chapter_tag)
|
||||
s.unwrap()
|
||||
for tag_name in LiveCartaConfig.TAGS_TO_UNWRAP:
|
||||
for tag in chapter_tag.select(tag_name):
|
||||
# if tag is a subtag
|
||||
if ">" in tag_name:
|
||||
parent = tag.parent
|
||||
tag.parent.attrs.update(tag.attrs)
|
||||
_add_span_to_save_ids_for_links(tag, chapter_tag)
|
||||
tag.unwrap()
|
||||
|
||||
|
||||
def _remove_headings_content(content_tag, title_of_chapter: str):
|
||||
|
||||
Reference in New Issue
Block a user