Mercurial > libervia-web
diff 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 |
line wrap: on
line diff
--- a/browser_side/tools.py Sat Nov 09 10:23:33 2013 +0100 +++ b/browser_side/tools.py Sat Nov 09 10:24:03 2013 +0100 @@ -21,12 +21,21 @@ from pyjamas.ui.DragWidget import DragWidget import re +from nativedom import NativeDOM +from sat.tools.frontends import xml + +dom = NativeDOM() def html_sanitize(html): """Naive sanitization of HTML""" return html.replace('<','<').replace('>','>') +def inlineRoot(xhtml): + """ make root element inline """ + doc = dom.parseString(xhtml) + return xml.inlineRoot(doc) + def addURLToText(string): """Check a text for what looks like an URL and make it clickable. Regexp from http://daringfireball.net/2010/07/improved_regex_for_matching_urls"""