diff src/plugins/plugin_xep_0277.py @ 1732:cf11cfc87ef9

xml_tools, plugin XEP-0071, XEP-0277: add method expandNewLinesToXHTML: - \n in XHTML content should not be converted to <br /> by the frontend - save it directly in the Atom payload for better compatibility with other clients
author souliane <souliane@mailoo.org>
date Thu, 10 Dec 2015 14:00:21 +0100
parents 0eaa1a409dfb
children 3770d13776e8
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0277.py	Thu Dec 10 10:44:04 2015 +0100
+++ b/src/plugins/plugin_xep_0277.py	Thu Dec 10 14:00:21 2015 +0100
@@ -180,6 +180,7 @@
                 key = check_conflict(u'{}_xhtml'.format(elem.name))
                 data = data_elt.toXml()
                 microblog_data[key] = yield self.host.plugins["TEXT-SYNTAXES"].clean_xhtml(data)
+                microblog_data[key] = xml_tools.expandNewLinesToXHTML(microblog_data[key])
             else:
                 key = check_conflict(elem.name)
                 microblog_data[key] = unicode(elem)
@@ -368,6 +369,7 @@
                                 raise failure.Failure(exceptions.DataError(_("Can't have xhtml and rich content at the same time")))
                         else:  # clean the XHTML input
                             converted = yield synt.clean_xhtml(data[attr])
+                        converted = xml_tools.expandNewLinesToXHTML(converted)
 
                         xml_content = u'<div xmlns="{ns}">{converted}</div>'.format(
                                         ns=NS_XHTML,