plugin (xep-0277): avoid wrapping XML in an extra <div> in data2entry
This commit is contained in:
parent
aa1e0714dd
commit
8b825d4055
1 changed files with 8 additions and 1 deletions
|
|
@ -370,7 +370,14 @@ class XEP_0277(object):
|
|||
xml_content = u'<div xmlns="{ns}">{converted}</div>'.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 <div> 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue