diff src/plugins/plugin_xep_0277.py @ 1733:3770d13776e8

plugin XEP-0277, xml_tools: restore decapsulation of XHTML content - to avoid successive nesting of the content in <div> - otherwise there is a new <div> at each item modification
author souliane <souliane@mailoo.org>
date Thu, 10 Dec 2015 14:21:51 +0100
parents cf11cfc87ef9
children 56fa4e7e158c
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0277.py	Thu Dec 10 14:00:21 2015 +0100
+++ b/src/plugins/plugin_xep_0277.py	Thu Dec 10 14:21:51 2015 +0100
@@ -178,7 +178,11 @@
                 if data_elt.uri != NS_XHTML:
                     raise failure.Failure(exceptions.DataError(_('Content of type XHTML must declare its namespace!')))
                 key = check_conflict(u'{}_xhtml'.format(elem.name))
-                data = data_elt.toXml()
+
+                # This is needed to avoid a successive encapsulation with a new <div>...</div>
+                # each time the item is modified (encapsulation is done in self.data2entry).
+                data = xml_tools.decapsulateDomishContent(data_elt)
+
                 microblog_data[key] = yield self.host.plugins["TEXT-SYNTAXES"].clean_xhtml(data)
                 microblog_data[key] = xml_tools.expandNewLinesToXHTML(microblog_data[key])
             else: