epub converter: tmp color fix

This commit is contained in:
shirshasa
2021-05-28 19:33:24 +03:00
parent cbc163d973
commit 268f7a3dc5
2 changed files with 4 additions and 1 deletions

View File

@@ -76,6 +76,7 @@ LIVECARTA_STYLE_ATTRS = {
'vertical-align': ['super'], # <sup>
'color': [],
'background-color': [],
'background': [],
'width': [],
'border-top-width': [],
'border-right-width': [],
@@ -99,6 +100,7 @@ LIVECARTA_STYLE_ATTRS_MAPPING = {
'font-size': convert_font_size,
'color': lambda x: LawCartaConfig.HTML42LIVECARTA_COLORS.get(str2color_name(x), ''),
'background-color': lambda x: LawCartaConfig.HTML42LIVECARTA_COLORS.get(str2color_name(x), ''),
'background': lambda x: LawCartaConfig.HTML42LIVECARTA_COLORS.get(str2color_name(x), ''),
'border-top-width': lambda x: x if x != '0' else '',
'border-right-width': lambda x: x if x != '0' else '',
'border-left-width': lambda x: x if x != '0' else '',
@@ -188,6 +190,7 @@ def add_inline_style_to_html_soup(soup1, css_text):
tag_with_style = soup2.find(attrs={'livecarta_id': i})
if tag_with_style.attrs.get('style'):
style = tag_with_style.attrs.get('style') + ';'
style = style.replace('background:', 'background-color:')
to_remove = check_style_to_be_tag(style)
new_tags = []