# HG changeset patch # User souliane # Date 1394839984 -3600 # Node ID 41b8b96f22481ce76d1993bb784f2db5b501af14 # Parent c393e7dc9ae6f4c1479a55ca7a61da655b78260b browser_side: display new lines in microblogs (convert '\n' to '
') diff -r c393e7dc9ae6 -r 41b8b96f2248 browser_side/base_panels.py --- a/browser_side/base_panels.py Sat Mar 15 00:21:04 2014 +0100 +++ b/browser_side/base_panels.py Sat Mar 15 00:33:04 2014 +0100 @@ -37,7 +37,7 @@ from datetime import datetime from time import time -from html_tools import html_sanitize, html_strip, inlineRoot +from html_tools import html_sanitize, html_strip, inlineRoot, convertNewLinesToXHTML from sat_frontends.tools.strings import addURLToText, addURLToImage from sat.core.i18n import _ @@ -505,7 +505,7 @@ text = addURLToImage(text) if self.options['enhance_display']: text = addURLToText(text) - self.display.setHTML(text) + self.display.setHTML(convertNewLinesToXHTML(text)) def setFocus(self, focus): raise NotImplementedError diff -r c393e7dc9ae6 -r 41b8b96f2248 browser_side/html_tools.py --- a/browser_side/html_tools.py Sat Mar 15 00:21:04 2014 +0100 +++ b/browser_side/html_tools.py Sat Mar 15 00:33:04 2014 +0100 @@ -40,3 +40,7 @@ """ make root element inline """ doc = dom.parseString(xhtml) return xmltools.inlineRoot(doc) + + +def convertNewLinesToXHTML(text): + return text.replace('\n', '
')