forked from LiveCarta/BookConverter
add background to divs
This commit is contained in:
@@ -316,6 +316,15 @@ def unwrap_structural_tags(body_tag):
|
||||
elif div_class in ['C441', 'C816']:
|
||||
_add_table_to_abc_books(div, border='solid #6e6e70 1px', bg_color='#e7e7e8')
|
||||
|
||||
if div.attrs.get('style'):
|
||||
if 'background-color' in div.attrs['style']:
|
||||
end_index = div.attrs['style'].find('background-color') + len('background-color')
|
||||
start_index_of_color = end_index + 2
|
||||
bg_color = div.attrs['style'][start_index_of_color:start_index_of_color+7]
|
||||
_add_table_to_abc_books(div, border='', bg_color=bg_color)
|
||||
|
||||
if div.attrs.get('style') == '':
|
||||
del div.attrs['style']
|
||||
if div.contents:
|
||||
is_not_struct_tag = [child.name not in structural_tags_names for child in div.contents]
|
||||
if all(is_not_struct_tag):
|
||||
|
||||
Reference in New Issue
Block a user