forked from LiveCarta/BookConverter
LAW-6695 | Add span with id in _remove_headings_content
This commit is contained in:
@@ -116,11 +116,21 @@ class HtmlPresetsProcessor:
|
|||||||
new_tag.string = "\xa0"
|
new_tag.string = "\xa0"
|
||||||
tag_to_be_removed.insert_before(new_tag)
|
tag_to_be_removed.insert_before(new_tag)
|
||||||
|
|
||||||
if tag_to_be_removed.attrs.get("id"):
|
def has_child_with_id(tag):
|
||||||
|
"""
|
||||||
|
Check if any child tag has an 'id' attribute.
|
||||||
|
"""
|
||||||
|
for child in tag.children:
|
||||||
|
if child.has_attr('id'):
|
||||||
|
return child
|
||||||
|
return False
|
||||||
|
|
||||||
|
child_with_id = has_child_with_id(tag_to_be_removed)
|
||||||
|
if tag_to_be_removed.attrs.get("id") or child_with_id:
|
||||||
_insert_span_with_attrs_before_tag(chapter_tag=chapter_tag,
|
_insert_span_with_attrs_before_tag(chapter_tag=chapter_tag,
|
||||||
tag_to_be_removed=tag_to_be_removed,
|
tag_to_be_removed=tag_to_be_removed,
|
||||||
id_=tag_to_be_removed.attrs["id"],
|
id_=tag_to_be_removed.attrs["id"] if tag_to_be_removed.attrs.get("id") else child_with_id.attrs["id"],
|
||||||
class_=tag_to_be_removed.attrs.get("class"))
|
class_=tag_to_be_removed.attrs["class"] if tag_to_be_removed.attrs.get("id") else child_with_id.attrs.get("class"))
|
||||||
|
|
||||||
def _process_tag_using_table(self, **kwargs):
|
def _process_tag_using_table(self, **kwargs):
|
||||||
def _wrap_tag_with_table(width: str = "100", border: str = "", bg_color: str = None) -> Tag:
|
def _wrap_tag_with_table(width: str = "100", border: str = "", bg_color: str = None) -> Tag:
|
||||||
|
|||||||
Reference in New Issue
Block a user