|
|
@ -639,10 +639,9 @@ def clean_html(html):
|
|
|
|
if html is None: # Convenience for sanitizing descriptions etc.
|
|
|
|
if html is None: # Convenience for sanitizing descriptions etc.
|
|
|
|
return html
|
|
|
|
return html
|
|
|
|
|
|
|
|
|
|
|
|
# Newline vs <br />
|
|
|
|
html = re.sub(r'\s+', ' ', html)
|
|
|
|
html = html.replace('\n', ' ')
|
|
|
|
html = re.sub(r'(?u)\s?<\s?br\s?/?\s?>\s?', '\n', html)
|
|
|
|
html = re.sub(r'(?u)\s*<\s*br\s*/?\s*>\s*', '\n', html)
|
|
|
|
html = re.sub(r'(?u)<\s?/\s?p\s?>\s?<\s?p[^>]*>', '\n', html)
|
|
|
|
html = re.sub(r'(?u)<\s*/\s*p\s*>\s*<\s*p[^>]*>', '\n', html)
|
|
|
|
|
|
|
|
# Strip html tags
|
|
|
|
# Strip html tags
|
|
|
|
html = re.sub('<.*?>', '', html)
|
|
|
|
html = re.sub('<.*?>', '', html)
|
|
|
|
# Replace html entities
|
|
|
|
# Replace html entities
|
|
|
|