feat(convert): sanitarisation html avec bs
This commit is contained in:
parent
a3a46e19c7
commit
1456a62b25
@ -2,6 +2,8 @@ from datetime import datetime
|
|||||||
|
|
||||||
from django.utils.timezone import make_aware, now
|
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.drupal import models as drupal
|
||||||
from drupal2spip_lal.spip import models as spip
|
from drupal2spip_lal.spip import models as spip
|
||||||
|
|
||||||
@ -16,8 +18,8 @@ def convert_timestamp(timestamp):
|
|||||||
|
|
||||||
|
|
||||||
def sanitarize_html(html):
|
def sanitarize_html(html):
|
||||||
# FIXME: bs4
|
soup = bs(html, 'html.parser')
|
||||||
return html
|
return soup.prettify(formatter="html5")
|
||||||
|
|
||||||
|
|
||||||
def convert_node(node, update=False):
|
def convert_node(node, update=False):
|
||||||
|
@ -6,3 +6,7 @@ django-environ ==0.4.5 # https://github.com/joke2k/django-environ
|
|||||||
# PHP
|
# PHP
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
phpserialize
|
phpserialize
|
||||||
|
|
||||||
|
# HTML
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
beautifulsoup4
|
||||||
|
Loading…
Reference in New Issue
Block a user