From a5a9853b64beb78b1c6531a9d67882b68136f616 Mon Sep 17 00:00:00 2001 From: shirshasa Date: Fri, 9 Jul 2021 10:35:31 +0300 Subject: [PATCH] epub converter: remove list-types --- src/css_reader.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/css_reader.py b/src/css_reader.py index 301be9e..7c835de 100644 --- a/src/css_reader.py +++ b/src/css_reader.py @@ -87,8 +87,8 @@ LIVECARTA_STYLE_ATTRS = { 'border-left-width': [], 'border-bottom-width': [], 'border': [], - 'list-style-type': [], - 'list-style-image': [] + # 'list-style-type': [], + # 'list-style-image': [] } """ @@ -126,8 +126,8 @@ LIVECARTA_STYLE_ATTRS_MAPPING = { 'border-right-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 '', - 'list-style-type': lambda x: x if x in list_types else 'disc', - 'list-style-image': lambda x: 'disc' + # 'list-style-type': lambda x: x if x in list_types else 'disc', + # 'list-style-image': lambda x: 'disc' } """ @@ -329,7 +329,7 @@ class TagStyleConverter: @staticmethod def add_span_to_save_style_attrs(t): 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'): new_tag = BeautifulSoup(features='lxml').new_tag(t.name) @@ -341,7 +341,7 @@ class TagStyleConverter: self.tag = self.change_attrs_with_corresponding_tags() 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_ul(self.tag) + # self.add_span_to_save_style_attrs_in_ul(self.tag) self.add_span_to_save_style_attrs(self.tag) return self.tag