forked from LiveCarta/BookConverter
Leave parent style only for decompose & unwrap
This commit is contained in:
@@ -28,6 +28,7 @@ class HtmlPresetsProcessor:
|
||||
|
||||
@staticmethod
|
||||
def _decompose_tag(**kwargs):
|
||||
kwargs["tag"].parent.attrs.update(kwargs["tag"].attrs)
|
||||
kwargs["tag"].decompose()
|
||||
|
||||
@staticmethod
|
||||
@@ -112,6 +113,7 @@ class HtmlPresetsProcessor:
|
||||
|
||||
@staticmethod
|
||||
def _unwrap_tag(**kwargs):
|
||||
kwargs["tag"].parent.attrs.update(kwargs["tag"].attrs)
|
||||
kwargs["tag"].unwrap()
|
||||
|
||||
@staticmethod
|
||||
@@ -153,7 +155,6 @@ class HtmlPresetsProcessor:
|
||||
for parent_tag in body_tag.select(condition_on_tag[1]):
|
||||
for tag in parent_tag.find_all([re.compile(tag) for tag in tags]):
|
||||
# parent_tag != tag.parent
|
||||
tag.parent.attrs.update(tag.attrs)
|
||||
action(body_tag=body_tag, tag=tag, rule=rule)
|
||||
elif condition_on_tag[0] == "child_tags":
|
||||
for tag in body_tag.find_all([re.compile(tag) for tag in tags]):
|
||||
|
||||
Reference in New Issue
Block a user