comparison 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
comparison
equal deleted inserted replaced
1732:cf11cfc87ef9 1733:3770d13776e8
176 if data_elt is None: 176 if data_elt is None:
177 raise failure.Failure(exceptions.DataError(u"XHML content not wrapped in a <div/> element, this is not standard !")) 177 raise failure.Failure(exceptions.DataError(u"XHML content not wrapped in a <div/> element, this is not standard !"))
178 if data_elt.uri != NS_XHTML: 178 if data_elt.uri != NS_XHTML:
179 raise failure.Failure(exceptions.DataError(_('Content of type XHTML must declare its namespace!'))) 179 raise failure.Failure(exceptions.DataError(_('Content of type XHTML must declare its namespace!')))
180 key = check_conflict(u'{}_xhtml'.format(elem.name)) 180 key = check_conflict(u'{}_xhtml'.format(elem.name))
181 data = data_elt.toXml() 181
182 # This is needed to avoid a successive encapsulation with a new <div>...</div>
183 # each time the item is modified (encapsulation is done in self.data2entry).
184 data = xml_tools.decapsulateDomishContent(data_elt)
185
182 microblog_data[key] = yield self.host.plugins["TEXT-SYNTAXES"].clean_xhtml(data) 186 microblog_data[key] = yield self.host.plugins["TEXT-SYNTAXES"].clean_xhtml(data)
183 microblog_data[key] = xml_tools.expandNewLinesToXHTML(microblog_data[key]) 187 microblog_data[key] = xml_tools.expandNewLinesToXHTML(microblog_data[key])
184 else: 188 else:
185 key = check_conflict(elem.name) 189 key = check_conflict(elem.name)
186 microblog_data[key] = unicode(elem) 190 microblog_data[key] = unicode(elem)