Mercurial > libervia-web
comparison src/browser/sat_browser/html_tools.py @ 803:89a0cd2aa763
browser_side: convertNewLinesToXHTML should only be called on raw text messages:
- some people use \n to aerate the text but don't necessarily want to see them as <br />
- method expandNewLinesToXHTML in backend finds the best out both editing styles
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 10 Dec 2015 13:30:27 +0100 |
parents | 9877607c719a |
children | f8a7a046ff9c |
comparison
equal
deleted
inserted
replaced
802:8faaaa6ec7ca | 803:89a0cd2aa763 |
---|---|
42 doc = dom.parseString(xhtml) | 42 doc = dom.parseString(xhtml) |
43 return xmltools.inlineRoot(doc) | 43 return xmltools.inlineRoot(doc) |
44 | 44 |
45 | 45 |
46 def convertNewLinesToXHTML(text): | 46 def convertNewLinesToXHTML(text): |
47 """Replace all the \n with <br/>""" | |
47 return text.replace('\n', '<br/>') | 48 return text.replace('\n', '<br/>') |
48 | 49 |
49 | 50 |
50 def XHTML2Text(xhtml): | 51 def XHTML2Text(xhtml): |
51 """Helper method to apply both html_sanitize and convertNewLinesToXHTML""" | 52 """Helper method to apply both html_sanitize and convertNewLinesToXHTML""" |