forked from mirrors/nixpkgs
Manual: Render strings containing special characters as indented strings
This commit is contained in:
parent
b64f43cdbd
commit
60c4c468f1
|
@ -90,8 +90,14 @@
|
||||||
|
|
||||||
|
|
||||||
<xsl:template match="string">
|
<xsl:template match="string">
|
||||||
<!-- !!! escaping -->
|
<xsl:choose>
|
||||||
<xsl:text>"</xsl:text><xsl:value-of select="str:replace(str:replace(str:replace(@value, '\', '\\'), '"', '\"'), '
', '\n')" /><xsl:text>"</xsl:text>
|
<xsl:when test="(contains(@value, '"') or contains(@value, '\')) and not(contains(@value, '
'))">
|
||||||
|
<xsl:text>''</xsl:text><xsl:value-of select='str:replace(@value, "${", "''${")' /><xsl:text>''</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>"</xsl:text><xsl:value-of select="str:replace(str:replace(str:replace(@value, '\', '\\'), '"', '\"'), '
', '\n')" /><xsl:text>"</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue