# HG changeset patch # User Goffi # Date 1452874439 -3600 # Node ID fed95a6c56f8aa96f0a9ae67f3472333dfe78b8e # Parent 07390a9d1c098f0a54c9aa0a0ac49587d6911e19 plugin (xep-0277): avoid wrapping XML in an extra
in data2entry diff -r 07390a9d1c09 -r fed95a6c56f8 src/plugins/plugin_xep_0277.py --- a/src/plugins/plugin_xep_0277.py Fri Jan 15 12:27:34 2016 +0100 +++ b/src/plugins/plugin_xep_0277.py Fri Jan 15 17:13:59 2016 +0100 @@ -370,7 +370,14 @@ xml_content = u'
{converted}
'.format( ns=NS_XHTML, converted=converted) - elem.addChild(xml_tools.ElementParser()(xml_content)) + div_elt = xml_tools.ElementParser()(xml_content) + if len(div_elt.children) == 1: + # if we have two
wrapping the content, + # we remove the one we have just added + child = div_elt.children[0] + if child.name == 'div' and not child.attributes and child.uri == div_elt.uri: + div_elt = child + elem.addChild(div_elt) elem['type'] = 'xhtml' if elem_name not in data: # there is raw text content, which is mandatory