Upgrade convert_textdivs_p to allow some children.
This commit is contained in:
parent
6e2c36bdbb
commit
68a555cfd8
1 changed files with 10 additions and 1 deletions
|
@ -164,7 +164,16 @@ def convert_textdivs_p(soup):
|
|||
divs = soup.find_all('div')
|
||||
for div in divs:
|
||||
children = list(div.children)
|
||||
if len(children) == 1 and isinstance(children[0], (str, bs4.element.NavigableString)):
|
||||
convertme = True
|
||||
for child in children:
|
||||
if isinstance(child, bs4.element.NavigableString):
|
||||
pass
|
||||
elif child.name in ['i', 'b', 'em', 'strong', 'a', 'span', 'small']:
|
||||
pass
|
||||
else:
|
||||
convertme = False
|
||||
break
|
||||
if convertme:
|
||||
div.name = 'p'
|
||||
|
||||
@soup_cleaner
|
||||
|
|
Loading…
Reference in a new issue