From 3cc6e41ad6db0082032e6bf10376213fe7e2b6aa Mon Sep 17 00:00:00 2001 From: souliane Date: Tue, 15 Dec 2015 20:29:19 +0100 Subject: [PATCH] tools, plugins XEP-0071, XEP-0277: remove recently added expandNewLinesToXHTML, just leave it to the convertors --- src/plugins/plugin_xep_0071.py | 1 - src/plugins/plugin_xep_0277.py | 1 - src/tools/xml_tools.py | 9 --------- 3 files changed, 11 deletions(-) diff --git a/src/plugins/plugin_xep_0071.py b/src/plugins/plugin_xep_0071.py index 45a307dd..6584a45e 100644 --- a/src/plugins/plugin_xep_0071.py +++ b/src/plugins/plugin_xep_0071.py @@ -119,7 +119,6 @@ class XEP_0071(object): raise exceptions.DataError(_("Can't have xhtml and rich content at the same time")) if xhtml: d = self.synt_plg.clean_xhtml(xhtml) - d.addCallback(xml_tools.expandNewLinesToXHTML) d.addCallback(syntax_converted) return d diff --git a/src/plugins/plugin_xep_0277.py b/src/plugins/plugin_xep_0277.py index 36bc8c1c..ff2f3cb8 100755 --- a/src/plugins/plugin_xep_0277.py +++ b/src/plugins/plugin_xep_0277.py @@ -372,7 +372,6 @@ class XEP_0277(object): 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'
{converted}
'.format( ns=NS_XHTML, diff --git a/src/tools/xml_tools.py b/src/tools/xml_tools.py index 71851731..019e64b9 100644 --- a/src/tools/xml_tools.py +++ b/src/tools/xml_tools.py @@ -1355,15 +1355,6 @@ class ElementParser(object): return self.result.firstChildElement() -def expandNewLinesToXHTML(text): - """Replace two or more "\n" with "\n
\n". - - @param text(unicode) - @return unicode - """ - return re.sub(r"\n{2,}", "\n
\n", text) - - def decapsulateDomishContent(elt): """Return the inner content of a domish.Element.