I am having an issue with some spaces appearing with std/xmltree.
In the following example, it works as expected:
import std/xmltree
var a = newXmlTree("text", [], [].toXmlAttributes)
a.add newText("Hola")
a.add newXmlTree("node", [], [].toXmlAttributes)
echo $a
I got:
<text>Hola<node /></text>
But in this case, there are some extra spaces that I don't know where are they coming from (that's why I am pasting the full crappy code).
When I run it, I get in the output the following extra spaces:
<y:NodeLabel textColor="#000000" hasLineColor="false" .... fontFamily="Dialog">Hola <y:LabelModel> <y:SmartNodeLabelModel distance="4.0" /> ....
^^^^^^^^^^ ^^^^^^^^^^^^
But I am doing exactly the same approach:
Why am I getting those extra spaces that are not added in above's example?
import std/xmltree
let x = newXmlTree("foo",[
newXmlTree("bar",[
newText("Hola"),
newXmlTree("qux",[
newXmlTree("plugh",[])
])
])
])
echo x
<foo>
<bar>Hola <qux> <plugh /> </qux></bar>
</foo>
Nodes that are considered "noWhitespace" due to containing text, are still indented.
I made a proposal that in your example would create:
<foo>
<bar>Hola<qux>
<plugh />
</qux>
</bar>
</foo>