diff --git a/src/css_reader.py b/src/css_reader.py index bfee39a..433e841 100644 --- a/src/css_reader.py +++ b/src/css_reader.py @@ -189,9 +189,9 @@ def clean_css(css): class TagStyleConverter: def __init__(self, tag, tag_with_style): - self.tag = tag + self.tag = tag # tag to be updated with style attribute self.tag_initial_name = tag.name - self.tag_with_style = tag_with_style + self.tag_with_style = tag_with_style # tag with inline style parsed from css file self.style = self.preprocess_style() @staticmethod @@ -227,6 +227,11 @@ class TagStyleConverter: style = self.remove_white_if_no_bgcolor(style, self.tag_with_style) style = style.replace('background:', 'background-color:') style = style.replace('list-style-image', 'list-style-type') + + # if tag had already had inline style, add this to style parsed from css + if self.tag.attrs.get('style') and self.tag.attrs['style'] not in style: + style += self.tag.attrs['style'] + print(style) return style def change_attrs_with_corresponding_tags(self):