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
This commit is contained in:
souliane 2015-12-10 14:21:51 +01:00
commit 2df5519eda
2 changed files with 19 additions and 1 deletions

View file

@ -178,7 +178,11 @@ class XEP_0277(object):
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: