# HG changeset patch # User souliane # Date 1418655781 -3600 # Node ID c8cca1a373dd3357bbdf44dc0f125a15be14e862 # Parent 6a1fea10ae8cdcefb31832afc35a960ea49de5b7 server_side: static blog: convert \n in raw text message to
diff -r 6a1fea10ae8c -r c8cca1a373dd src/server/blog.py --- a/src/server/blog.py Mon Dec 15 16:01:51 2014 +0100 +++ b/src/server/blog.py Mon Dec 15 16:03:01 2014 +0100 @@ -31,7 +31,7 @@ import re import os -from libervia.server.html_tools import sanitizeHtml +from libervia.server.html_tools import sanitizeHtml, convertNewLinesToXHTML from libervia.server.constants import Const as C @@ -348,7 +348,7 @@ return entry['%s_xhtml' % key].encode('utf-8') elif key in entry: processor = addURLToText if key.startswith('content') else sanitizeHtml - return processor(entry[key]).encode('utf-8') + return convertNewLinesToXHTML(processor(entry[key])).encode('utf-8') return '' def addMainItemLink(elem): diff -r 6a1fea10ae8c -r c8cca1a373dd src/server/html_tools.py --- a/src/server/html_tools.py Mon Dec 15 16:01:51 2014 +0100 +++ b/src/server/html_tools.py Mon Dec 15 16:03:01 2014 +0100 @@ -30,3 +30,7 @@ } return "".join(html_escape_table.get(c, c) for c in text) + + +def convertNewLinesToXHTML(text): + return text.replace('\n', '
')