feat(convert): sanitarisation html avec bs

This commit is contained in:
François Poulain 2020-08-03 18:18:12 +02:00
parent a3a46e19c7
commit 1456a62b25
2 changed files with 8 additions and 2 deletions

View File

@ -2,6 +2,8 @@ from datetime import datetime
from django.utils.timezone import make_aware, now
from bs4 import BeautifulSoup as bs
from drupal2spip_lal.drupal import models as drupal
from drupal2spip_lal.spip import models as spip
@ -16,8 +18,8 @@ def convert_timestamp(timestamp):
def sanitarize_html(html):
# FIXME: bs4
return html
soup = bs(html, 'html.parser')
return soup.prettify(formatter="html5")
def convert_node(node, update=False):

View File

@ -6,3 +6,7 @@ django-environ ==0.4.5 # https://github.com/joke2k/django-environ
# PHP
# ------------------------------------------------------------------------------
phpserialize
# HTML
# ------------------------------------------------------------------------------
beautifulsoup4