comparison src/plugins/plugin_xep_0071.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 94901070478e
children 6fd0881fe1fc
comparison
equal deleted inserted replaced
1731:58ecc0e2e6fc 1732:cf11cfc87ef9
20 from sat.core.i18n import _ 20 from sat.core.i18n import _
21 from sat.core import exceptions 21 from sat.core import exceptions
22 from sat.core.log import getLogger 22 from sat.core.log import getLogger
23 log = getLogger(__name__) 23 log = getLogger(__name__)
24 24
25 from sat.tools import xml_tools
25 from wokkel import disco, iwokkel 26 from wokkel import disco, iwokkel
26 from zope.interface import implements 27 from zope.interface import implements
27 # from lxml import etree 28 # from lxml import etree
28 try: 29 try:
29 from lxml import html 30 from lxml import html
116 d = self.synt_plg.convert(rich, syntax, self.SYNTAX_XHTML_IM) 117 d = self.synt_plg.convert(rich, syntax, self.SYNTAX_XHTML_IM)
117 if xhtml: 118 if xhtml:
118 raise exceptions.DataError(_("Can't have xhtml and rich content at the same time")) 119 raise exceptions.DataError(_("Can't have xhtml and rich content at the same time"))
119 if xhtml: 120 if xhtml:
120 d = self.synt_plg.clean_xhtml(xhtml) 121 d = self.synt_plg.clean_xhtml(xhtml)
122 d.addCallback(xml_tools.expandNewLinesToXHTML)
121 d.addCallback(syntax_converted) 123 d.addCallback(syntax_converted)
122 return d 124 return d
123 125
124 def messageReceivedTrigger(self, message, post_treat, profile): 126 def messageReceivedTrigger(self, message, post_treat, profile):
125 """ Check presence of XHTML-IM in message 127 """ Check presence of XHTML-IM in message