classification
Title: Minidom should not pretty-print inside text elements
Type: Stage:
Components: XML Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: mitar
Priority: normal Keywords:

Created on 2019-06-28 18:04 by mitar, last changed 2019-06-28 18:04 by mitar.

Messages (1)
msg346846 - (view) Author: Mitar (mitar) * Date: 2019-06-28 18:04
Inside text elements both in HTML and SVG white-space is significant and introduces differences in how things are rendered. By default in general all white-space is collapsed into one space and then this is rendered, adding additional text content.

I observed this while working with SVG which can have content like:

<text><tspan>foo</tspan><tspan>bar</tspan></text>

After pretty-printing it with minidom, and white-space collapsing, the following is what is input to SVG rendering:

<text> <tspan>foo</tspan> <tspan>bar</tspan> </text>

And space between "foo" and "bar" is now visible and while before it was one word to the user, now it is shown as two.

Related issue: https://github.com/mozman/svgwrite/issues/58

I think pretty-printing not add whitespace inside text elements.
History
Date User Action Args
2019-06-28 18:04:51mitarcreate