comparison browser/sat_browser/html_tools.py @ 1156:3048bd137aaf

server, browser: changed blog items serialisation following changes in backend
author Goffi <goffi@goffi.org>
date Sat, 23 Feb 2019 21:03:21 +0100
parents 2af117bfe6cc
children
comparison
equal deleted inserted replaced
1155:813d54af8c0c 1156:3048bd137aaf
26 26
27 27
28 def html_sanitize(html): 28 def html_sanitize(html):
29 """Naive sanitization of HTML""" 29 """Naive sanitization of HTML"""
30 return html.replace('<', '&lt;').replace('>', '&gt;') 30 return html.replace('<', '&lt;').replace('>', '&gt;')
31
32 31
33 def html_strip(html): 32 def html_strip(html):
34 """Strip leading/trailing white spaces, HTML line breaks and &nbsp; sequences.""" 33 """Strip leading/trailing white spaces, HTML line breaks and &nbsp; sequences."""
35 JS("""return html.replace(/(^(<br\/?>|&nbsp;|\s)+)|((<br\/?>|&nbsp;|\s)+$)/g, "");""") 34 JS("""return html.replace(/(^(<br\/?>|&nbsp;|\s)+)|((<br\/?>|&nbsp;|\s)+$)/g, "");""")
36 35