summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-09-23 23:01:13 +0200
committerFlorent Le Coz <louiz@louiz.org>2011-09-23 23:01:13 +0200
commit1ff421075def58b31f06f32a481ab4d6f4c67fa8 (patch)
tree6d0a1e1fa4549b8f86313a1f7d8ce7091fc3b526
parenta9d2cf8ff237e164e187c9e48745641e7db6deb8 (diff)
downloadpoezio-1ff421075def58b31f06f32a481ab4d6f4c67fa8.tar.gz
poezio-1ff421075def58b31f06f32a481ab4d6f4c67fa8.tar.bz2
poezio-1ff421075def58b31f06f32a481ab4d6f4c67fa8.tar.xz
poezio-1ff421075def58b31f06f32a481ab4d6f4c67fa8.zip
Do not remove trailing spaces in an XHTML-IM element’s text.
-rw-r--r--src/xhtml.py7
1 files changed, 1 insertions, 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'