diff browser_side/tools.py @ 349:f488692c4903

browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
author souliane <souliane@mailoo.org>
date Wed, 12 Feb 2014 14:58:11 +0100
parents f1ba38043d78
children 187126b63170
line wrap: on
line diff
--- a/browser_side/tools.py	Wed Feb 12 14:51:13 2014 +0100
+++ b/browser_side/tools.py	Wed Feb 12 14:58:11 2014 +0100
@@ -56,6 +56,13 @@
     return cleaned.strip()
 
 
+def html_strip(html):
+    """Strip leading/trailing white spaces, HTML line breaks and &nbsp; sequences."""
+    cleaned = re.sub(r"^(<br/?>|&nbsp;|\s)+", "", html)
+    cleaned = re.sub(r"(<br/?>|&nbsp;|\s)+$", "", cleaned)
+    return cleaned
+
+
 def inlineRoot(xhtml):
     """ make root element inline """
     doc = dom.parseString(xhtml)