[New-bugs-announce] [issue37442] Minidom should not pretty-print inside text elements

Mitar report at bugs.python.org
Fri Jun 28 14:04:51 EDT 2019


New submission from Mitar <mmitar at gmail.com>:

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.

----------
components: XML
messages: 346846
nosy: mitar
priority: normal
severity: normal
status: open
title: Minidom should not pretty-print inside text elements
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37442>
_______________________________________


More information about the New-bugs-announce mailing list