forked from LiveCarta/BookConverter
epub converter: fix bg-color
This commit is contained in:
@@ -97,7 +97,9 @@ def preprocess_table(body_tag: BeautifulSoup):
|
||||
|
||||
if width:
|
||||
td.attrs['width'] = width
|
||||
td.attrs['style'] = td.attrs.get('style').replace('border:0;', '')
|
||||
|
||||
if td.attrs.get('style'):
|
||||
td.attrs['style'] = td.attrs['style'].replace('border:0;', '')
|
||||
|
||||
if border_sizes:
|
||||
border_size = sum(border_sizes) / len(border_sizes)
|
||||
@@ -270,16 +272,16 @@ def unwrap_structural_tags(body_tag):
|
||||
'figure', 'footer', 'iframe', 'span', 'p'
|
||||
]
|
||||
# should be before other tags processing, not to remove converter empty tags with id
|
||||
for s in body_tag.find_all("span"):
|
||||
if (s.attrs.get('epub:type') == 'pagebreak') or s.attrs.get('id'):
|
||||
continue
|
||||
if s.contents:
|
||||
is_not_struct_tag = [child.name not in structural_tags_names for child in s.contents]
|
||||
if all(is_not_struct_tag):
|
||||
continue
|
||||
|
||||
_add_span_to_save_ids_for_links(s)
|
||||
s.unwrap()
|
||||
# for s in body_tag.find_all("span"):
|
||||
# if (s.attrs.get('epub:type') == 'pagebreak') or s.attrs.get('id'):
|
||||
# continue
|
||||
# if s.contents:
|
||||
# is_not_struct_tag = [child.name not in structural_tags_names for child in s.contents]
|
||||
# if all(is_not_struct_tag):
|
||||
# continue
|
||||
#
|
||||
# _add_span_to_save_ids_for_links(s)
|
||||
# s.unwrap()
|
||||
|
||||
for div in body_tag.find_all("div"):
|
||||
if div.contents:
|
||||
|
||||
Reference in New Issue
Block a user