Convert div to table (width, border, bgcolor in attr)

This commit is contained in:
Kiryl
2022-06-22 18:20:57 +03:00
parent 0f53caaffa
commit 43e16ed8d2

View File

@@ -276,7 +276,7 @@ def _preprocess_div_tags(chapter_tag):
Function replace <div> with <table>:
"""
for div in chapter_tag.find_all("div"):
if div.attrs.get('style'):
if any(attr in ['width', 'border', 'bgcolor'] for attr in div.attrs):
_wrap_tag_with_table(
chapter_tag,
tag_to_be_wrapped=div,