Commit 56bbc0d1 authored by Thomas B. Rücker's avatar Thomas B. Rücker 😊
Browse files

Fix issue with only "-" and whitespace in element

Fixes: #2198

If there is a single "-" or it is only accompanied by whitespace, then
it wouldn't get escaped as it was detected as as a number. This would
produce invalid JSON.
This makes the numbers part ignore such and thus ensures it gets escaped
as text.

There might be other corner cases related to number parsing, this should be investigated.
parent 0b1ac3e9
......@@ -126,7 +126,8 @@
<!-- number (no support for javascript mantissa) -->
<xsl:template match="text()[not(string(number())='NaN' or
(starts-with(.,'0' ) and . != '0' and not(starts-with(.,'0.' ))) or
(starts-with(.,'-0' ) and . != '-0' and not(starts-with(.,'-0.' ))))]">
(starts-with(.,'-0' ) and . != '-0' and not(starts-with(.,'-0.' )))) and
not(substring(normalize-space(.), string-length(normalize-space(.))) = '-')]">
<xsl:when test="starts-with(.,'.')">
<xsl:value-of select="concat('0',.)"/>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment