Mercurial > libervia-web
comparison browser_side/tools.py @ 246:d7c41c84d062
browser side: use of inlineRoot to display XHTML chat text
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 09 Nov 2013 10:24:03 +0100 |
parents | f7ec248192de |
children | aebb96bfa8d1 |
comparison
equal
deleted
inserted
replaced
245:43881c3dda9d | 246:d7c41c84d062 |
---|---|
19 along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 """ | 20 """ |
21 | 21 |
22 from pyjamas.ui.DragWidget import DragWidget | 22 from pyjamas.ui.DragWidget import DragWidget |
23 import re | 23 import re |
24 from nativedom import NativeDOM | |
25 from sat.tools.frontends import xml | |
26 | |
27 dom = NativeDOM() | |
24 | 28 |
25 def html_sanitize(html): | 29 def html_sanitize(html): |
26 """Naive sanitization of HTML""" | 30 """Naive sanitization of HTML""" |
27 return html.replace('<','<').replace('>','>') | 31 return html.replace('<','<').replace('>','>') |
28 | 32 |
33 | |
34 def inlineRoot(xhtml): | |
35 """ make root element inline """ | |
36 doc = dom.parseString(xhtml) | |
37 return xml.inlineRoot(doc) | |
29 | 38 |
30 def addURLToText(string): | 39 def addURLToText(string): |
31 """Check a text for what looks like an URL and make it clickable. Regexp | 40 """Check a text for what looks like an URL and make it clickable. Regexp |
32 from http://daringfireball.net/2010/07/improved_regex_for_matching_urls""" | 41 from http://daringfireball.net/2010/07/improved_regex_for_matching_urls""" |
33 | 42 |