Fix whitespace collapsing when it shouldn't on non-textual elements that have xml:space=preserve
This commit is contained in:
parent
6482314390
commit
99dfb0f819
4 changed files with 17 additions and 3 deletions
3
scour.py
3
scour.py
|
|
@ -2098,8 +2098,7 @@ def serializeXML(element, options, ind = 0, preserveWhitespace = False):
|
|||
elif child.nodeType == 3:
|
||||
# trim it only in the case of not being a child of an element
|
||||
# where whitespace might be important
|
||||
if element.nodeName in ["text", "tspan", "textPath", "tref", "title", "desc", "textArea",
|
||||
"flowRoot", "flowDiv", "flowSpan", "flowPara", "flowRegion"]:
|
||||
if preserveWhitespace:
|
||||
outString += makeWellFormed(child.nodeValue)
|
||||
else:
|
||||
outString += makeWellFormed(child.nodeValue.strip())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue