From 1ff421075def58b31f06f32a481ab4d6f4c67fa8 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Fri, 23 Sep 2011 23:01:13 +0200 Subject: [PATCH] =?UTF-8?q?Do=20not=20remove=20trailing=20spaces=20in=20an?= =?UTF-8?q?=20XHTML-IM=20element=E2=80=99s=20text.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/xhtml.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/xhtml.py b/src/xhtml.py index 949044b1..d25500f0 100644 --- a/src/xhtml.py +++ b/src/xhtml.py @@ -174,10 +174,6 @@ colors = { log = logging.getLogger(__name__) -shell_colors_re = re.compile(r'(\[(?:\d+;)*(?:\d+m))') -start_indent_re = re.compile(r'\[0;30m\[0;37m ') -newline_indent_re = re.compile('\n\[0;37m ') - def get_body_from_message_stanza(message): """ Returns a string with xhtml markups converted to @@ -190,7 +186,6 @@ def get_body_from_message_stanza(message): return xhtml_to_poezio_colors(xhtml_body) return message['body'] - def xhtml_to_poezio_colors(text): def parse_css(css): def get_color(value): @@ -289,7 +284,7 @@ def xhtml_to_poezio_colors(text): if (elem.text and elem.tag != '{http://www.w3.org/1999/xhtml}a' and elem.tag != '{http://www.w3.org/1999/xhtml}br' and elem.tag != '{http://www.w3.org/1999/xhtml}img'): - message += elem.text.strip() + message += elem.text.replace('\n', '') if ('style' in elem.attrib and elem.tag != '{http://www.w3.org/1999/xhtml}br' and elem.tag != '{http://www.w3.org/1999/xhtml}em'