Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-04-02 12:40:45 -0400
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-04-02 12:40:50 -0400
commitc15ed8a2cd69237375a1ee7daf2e574d9586db2c (patch)
tree7929248027028fc3d42eef4a8e411bdad13281b4 /src
parent189751d5cc457f457bce86a368483779a9b09fff (diff)
downloadtame-c15ed8a2cd69237375a1ee7daf2e574d9586db2c.tar.gz
tame-c15ed8a2cd69237375a1ee7daf2e574d9586db2c.tar.bz2
tame-c15ed8a2cd69237375a1ee7daf2e574d9586db2c.zip
Add class, param, const, rate to param-value/@identifierv2.13.0
* src/current/include/preproc/template.xsl (preproc:gen-param-value-style)[lv:param-value[@identifier]]: Add support for class, param, const, rate styling.
Diffstat (limited to 'src')
-rw-r--r--src/current/include/preproc/template.xsl31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/current/include/preproc/template.xsl b/src/current/include/preproc/template.xsl
index a7cd137..e0294e7 100644
--- a/src/current/include/preproc/template.xsl
+++ b/src/current/include/preproc/template.xsl
@@ -1167,8 +1167,37 @@
mode="preproc:gen-param-value-style" priority="6">
<xsl:param name="str" />
+ <xsl:variable name="norm" as="xs:string"
+ select="normalize-unicode( $str, 'NFC' )" />
+
+ <xsl:variable name="pre" as="xs:string">
+ <xsl:choose >
+ <xsl:when test="@identifier = 'class'">
+ <xsl:sequence select="replace( lower-case( $norm ), '[_ ]', '-' )" />
+ </xsl:when>
+
+ <xsl:when test="@identifier = 'param'">
+ <xsl:sequence select="replace( lower-case( $norm ), '[- ]', '_' )" />
+ </xsl:when>
+
+ <xsl:when test="@identifier = 'const'">
+ <xsl:sequence select="replace( upper-case( $norm ), '[- ]', '_' )" />
+ </xsl:when>
+
+ <!-- TODO: camelCase -->
+ <xsl:when test="@identifier = 'rate'">
+ <xsl:sequence select="replace( $norm, '[-_ ]', '' )" />
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:sequence select="$norm" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- everything else gets removed -->
<xsl:sequence select="replace(
- normalize-unicode( $str, 'NFC' ),
+ $pre,
'[^a-zA-Z0-9_-]',
'' )" />
</xsl:template>