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> 'vertical-align': ['super'], # <sup>
'color': [], 'color': [],
'background-color': [], 'background-color': [],
'background': [],
'width': [], 'width': [],
'border-top-width': [], 'border-top-width': [],
'border-right-width': [], 'border-right-width': [],
@@ -99,6 +100,7 @@ LIVECARTA_STYLE_ATTRS_MAPPING = {
'font-size': convert_font_size, 'font-size': convert_font_size,
'color': lambda x: LawCartaConfig.HTML42LIVECARTA_COLORS.get(str2color_name(x), ''), 'color': lambda x: LawCartaConfig.HTML42LIVECARTA_COLORS.get(str2color_name(x), ''),
'background-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-top-width': lambda x: x if x != '0' else '',
'border-right-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 '', '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}) tag_with_style = soup2.find(attrs={'livecarta_id': i})
if tag_with_style.attrs.get('style'): if tag_with_style.attrs.get('style'):
style = 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) to_remove = check_style_to_be_tag(style)
new_tags = [] new_tags = []

View File

@@ -102,7 +102,7 @@ class LawCartaConfig:
'purple': 'darkMagenta', 'purple': 'darkMagenta',
'olive': 'darkGreen', 'olive': 'darkGreen',
'silver': 'lightGray', 'silver': 'lightGray',
'white': 'white', 'white': 'black',
'maroon': '#800000', 'maroon': '#800000',
'gray': '#808080' 'gray': '#808080'
} }