strip <p>

This commit is contained in:
j 2013-10-31 13:49:55 +01:00
parent 5dcd8b3552
commit d38da54a17

View file

@ -318,5 +318,7 @@ def sanitize_fragment(html):
'''
import lxml.html
body = lxml.html.document_fromstring(html).find('body')
return lxml.html.tostring(body, encoding='utf-8')[6:-7].decode('utf-8')
html = lxml.html.tostring(body, encoding='utf-8')[6:-7].decode('utf-8')
if html.startswith('<p>') and html.endswith('</p>'):
html = html[3:-4]
return html