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:
parent
ca5c913ce2
commit
2df5519eda
2 changed files with 19 additions and 1 deletions
|
|
@ -1361,3 +1361,17 @@ def expandNewLinesToXHTML(text):
|
|||
"""
|
||||
# if present, replace <br> (HTML), <br > and <br/> at end of line with <br /> (XHTML)
|
||||
return re.sub(r"<br[ ]?/?>\n", "\n", text).replace("\n", "<br />\n")
|
||||
|
||||
|
||||
def decapsulateDomishContent(elt):
|
||||
"""Return the inner content of a domish.Element.
|
||||
|
||||
@return unicode
|
||||
"""
|
||||
result = ''
|
||||
for child in elt.children:
|
||||
try:
|
||||
result += child.toXml() # child id a domish.Element
|
||||
except AttributeError:
|
||||
result += child # child is unicode
|
||||
return result
|
||||
|
|
|
|||
Loading…
Reference in a new issue