forked from LiveCarta/BookConverter
epub converter: update css_reader.py
This commit is contained in:
@@ -189,9 +189,9 @@ def clean_css(css):
|
|||||||
|
|
||||||
class TagStyleConverter:
|
class TagStyleConverter:
|
||||||
def __init__(self, tag, tag_with_style):
|
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_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()
|
self.style = self.preprocess_style()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -227,6 +227,11 @@ class TagStyleConverter:
|
|||||||
style = self.remove_white_if_no_bgcolor(style, self.tag_with_style)
|
style = self.remove_white_if_no_bgcolor(style, self.tag_with_style)
|
||||||
style = style.replace('background:', 'background-color:')
|
style = style.replace('background:', 'background-color:')
|
||||||
style = style.replace('list-style-image', 'list-style-type')
|
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
|
return style
|
||||||
|
|
||||||
def change_attrs_with_corresponding_tags(self):
|
def change_attrs_with_corresponding_tags(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user