forked from LiveCarta/BookConverter
epub converter: remove list-types
This commit is contained in:
@@ -87,8 +87,8 @@ LIVECARTA_STYLE_ATTRS = {
|
|||||||
'border-left-width': [],
|
'border-left-width': [],
|
||||||
'border-bottom-width': [],
|
'border-bottom-width': [],
|
||||||
'border': [],
|
'border': [],
|
||||||
'list-style-type': [],
|
# 'list-style-type': [],
|
||||||
'list-style-image': []
|
# 'list-style-image': []
|
||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -126,8 +126,8 @@ LIVECARTA_STYLE_ATTRS_MAPPING = {
|
|||||||
'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 '',
|
||||||
'border-bottom-width': lambda x: x if x != '0' else '',
|
'border-bottom-width': lambda x: x if x != '0' else '',
|
||||||
'list-style-type': lambda x: x if x in list_types else 'disc',
|
# 'list-style-type': lambda x: x if x in list_types else 'disc',
|
||||||
'list-style-image': lambda x: 'disc'
|
# 'list-style-image': lambda x: 'disc'
|
||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -329,7 +329,7 @@ class TagStyleConverter:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def add_span_to_save_style_attrs(t):
|
def add_span_to_save_style_attrs(t):
|
||||||
h_regex = f'(^h[1-9]$)'
|
h_regex = f'(^h[1-9]$)'
|
||||||
no_style_in_livecarta_regexp = re.compile(r'(^ol$)|' + h_regex)
|
no_style_in_livecarta_regexp = re.compile(r'(^ol$)(^ul$)|' + h_regex)
|
||||||
|
|
||||||
if re.search(no_style_in_livecarta_regexp, t.name) and t.attrs.get('style'):
|
if re.search(no_style_in_livecarta_regexp, t.name) and t.attrs.get('style'):
|
||||||
new_tag = BeautifulSoup(features='lxml').new_tag(t.name)
|
new_tag = BeautifulSoup(features='lxml').new_tag(t.name)
|
||||||
@@ -341,7 +341,7 @@ class TagStyleConverter:
|
|||||||
self.tag = self.change_attrs_with_corresponding_tags()
|
self.tag = self.change_attrs_with_corresponding_tags()
|
||||||
self.wrap_p_to_save_style_attrs(self.tag)
|
self.wrap_p_to_save_style_attrs(self.tag)
|
||||||
self.add_span_to_save_style_attrs_in_li(self.tag)
|
self.add_span_to_save_style_attrs_in_li(self.tag)
|
||||||
self.add_span_to_save_style_attrs_in_ul(self.tag)
|
# self.add_span_to_save_style_attrs_in_ul(self.tag)
|
||||||
self.add_span_to_save_style_attrs(self.tag)
|
self.add_span_to_save_style_attrs(self.tag)
|
||||||
return self.tag
|
return self.tag
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user