forked from LiveCarta/BookConverter
Add htm support in processing anchors
This commit is contained in:
@@ -100,11 +100,12 @@ LIVECARTA_STYLE_ATTRS = {
|
||||
'background-color': [],
|
||||
'background': [],
|
||||
'width': [],
|
||||
'border': [],
|
||||
'border-top-width': [],
|
||||
'border-right-width': [],
|
||||
'border-left-width': [],
|
||||
'border-bottom-width': [],
|
||||
'border': [],
|
||||
'border-bottom': [],
|
||||
'list-style-type': [],
|
||||
'list-style-image': [],
|
||||
'margin-left': []
|
||||
@@ -145,6 +146,7 @@ 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 '',
|
||||
'border-bottom': 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',
|
||||
'margin-left': convert_indents
|
||||
@@ -409,9 +411,9 @@ class TagStyleConverter:
|
||||
@staticmethod
|
||||
def add_span_to_save_style_attrs_in_ul_ol(t):
|
||||
if t.name in ['ul', 'ol'] and t.attrs.get('style'):
|
||||
styles_cant_be_in_li = [attr for attr in LIVECARTA_STYLE_ATTRS if attr not in ['list-style-type']]
|
||||
styles_cant_be_in_ul_ol = [attr for attr in LIVECARTA_STYLE_ATTRS if attr not in ['list-style-type']]
|
||||
|
||||
check = [attr in t.attrs.get('style') for attr in styles_cant_be_in_li]
|
||||
check = [attr in t.attrs.get('style') for attr in styles_cant_be_in_ul_ol]
|
||||
if any(check):
|
||||
t.name = 'span'
|
||||
li_tag = BeautifulSoup(features='lxml').new_tag('ul')
|
||||
|
||||
Reference in New Issue
Block a user