forked from LiveCarta/BookConverter
Fix style processor error
This commit is contained in:
@@ -126,17 +126,18 @@ class StyleReader:
|
||||
return constraints_on_value, value_not_in_possible_values_list
|
||||
|
||||
def update_inline_styles_to_livecarta_convention(self, split_style: list) -> list:
|
||||
for i, style in enumerate(split_style):
|
||||
for i, style in reversed(list(enumerate(split_style))):
|
||||
style_name, style_value = style.split(":")
|
||||
if style_name not in LiveCartaConfig.LIVECARTA_STYLE_ATTRS:
|
||||
# property not in LIVECARTA_STYLE_ATTRS, remove from css file
|
||||
split_style[i] = ""
|
||||
return split_style
|
||||
# property not in LIVECARTA_STYLE_ATTRS, remove
|
||||
split_style.remove(style)
|
||||
continue
|
||||
|
||||
cleaned_value = self.clean_value(style_value, style_name)
|
||||
if all(self.style_conditions(cleaned_value, style_name)):
|
||||
# there are constraints + value not in LIVECARTA_STYLE_ATTRS, remove from css file
|
||||
split_style[i] = ""
|
||||
# there are constraints + value not in LIVECARTA_STYLE_ATTRS, remove
|
||||
split_style.remove(style)
|
||||
continue
|
||||
else:
|
||||
if style_name in self.LIVECARTA_STYLE_ATTRS_MAPPING:
|
||||
# function that converts our data
|
||||
@@ -157,7 +158,7 @@ class StyleReader:
|
||||
|
||||
split_style = self.update_inline_styles_to_livecarta_convention(
|
||||
split_style)
|
||||
style = "; ".join(split_style)
|
||||
style = "; ".join(split_style) if split_style else ""
|
||||
return style
|
||||
|
||||
def process_inline_styles_in_html_soup(self, html_content):
|
||||
|
||||
Reference in New Issue
Block a user