forked from LiveCarta/BookConverter
epub converter: fix removing <p>
This commit is contained in:
@@ -220,10 +220,14 @@ def add_inline_style_to_html_soup(soup1, css_text):
|
||||
style_ = style_.replace('color:white;', '')
|
||||
return style_
|
||||
|
||||
def wrap_p_if_bg_color(t):
|
||||
if (t.name == 'p' and t.attrs.get('style')) and ('background' in t.attrs.get('style')):
|
||||
t.name = 'span'
|
||||
t.wrap( BeautifulSoup(features='lxml').new_tag('p'))
|
||||
def wrap_p_to_save_style_attrs(t):
|
||||
styles_cant_be_in_p = [attr for attr in LIVECARTA_STYLE_ATTRS if attr not in ['text-align', 'text-indent']]
|
||||
|
||||
if t.name == 'p' and t.attrs.get('style'):
|
||||
check = [attr in t.attrs.get('style') for attr in styles_cant_be_in_p]
|
||||
if any(check):
|
||||
t.name = 'span'
|
||||
t.wrap( BeautifulSoup(features='lxml').new_tag('p'))
|
||||
|
||||
for i in livecarta_tmp_ids:
|
||||
tag = soup1.find(attrs={'livecarta_id': i})
|
||||
|
||||
Reference in New Issue
Block a user