Add c:vector as c:set alternative
The term "set" is all wrong---it is actally intended to be a vector, and can absolutely have duplicate elements (and often does). * src/current/calc.xsd (vector): Add, recommending in place of `set'. * src/current/compiler/js-calc.xsl (compile-calc)[c:set|c:vector]: Add `c:vector' and provide deprecation notice for `c:set'. * src/current/include/calc-display.xsl (c:set|c:vector): Likewise.master
parent
e4ccf3e90a
commit
b725963722
|
@ -580,7 +580,22 @@
|
|||
<xs:element name="set" substitutionGroup="operator">
|
||||
<xs:annotation>
|
||||
<xs:documentation xml:lang="en">
|
||||
Creates a set out of its siblings
|
||||
Creates a set out of its siblings (deprecated in favor of
|
||||
c:vector)
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
|
||||
<xs:complexType>
|
||||
<xs:complexContent>
|
||||
<xs:extension base="operatorBaseType" />
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="vector" substitutionGroup="operator">
|
||||
<xs:annotation>
|
||||
<xs:documentation xml:lang="en">
|
||||
Creates a vector out of its siblings
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
|
||||
|
|
|
@ -1009,7 +1009,16 @@
|
|||
</template>
|
||||
|
||||
|
||||
<template match="c:set" mode="compile-calc">
|
||||
<!--
|
||||
TODO: Remove c:set in the future.
|
||||
-->
|
||||
<template match="c:set" mode="compile-calc" priority="9">
|
||||
<message select="'warning: c:set is deprecated; use c:vector instead'" />
|
||||
<next-match />
|
||||
</template>
|
||||
|
||||
|
||||
<template match="c:set|c:vector" mode="compile-calc" priority="5">
|
||||
<text>[</text>
|
||||
<for-each select="./c:*">
|
||||
<if test="position() > 1">
|
||||
|
|
|
@ -671,10 +671,9 @@
|
|||
|
||||
|
||||
<!--
|
||||
TODO: Technically this is incorrect; sets cannot have duplicate values. This
|
||||
would be best styled as a vector/matrix/etc.
|
||||
Style vectors
|
||||
-->
|
||||
<xsl:template match="c:set" priority="1">
|
||||
<xsl:template match="c:set|c:vector" priority="1">
|
||||
<xsl:text>\left[</xsl:text>
|
||||
<xsl:for-each select="./c:*">
|
||||
<xsl:if test="position() > 1">
|
||||
|
@ -686,11 +685,16 @@
|
|||
<xsl:text>\right]^T</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<!-- style subsets as matrices (easier to read) -->
|
||||
<xsl:template match="c:set[ ./c:set ]" priority="5">
|
||||
|
||||
<!--
|
||||
Style vector of vector as matrix
|
||||
-->
|
||||
<xsl:template priority="5"
|
||||
match="c:set[ c:set ]
|
||||
|c:vector[ c:vector ]">
|
||||
<xsl:text>\left[\begin{array}\\</xsl:text>
|
||||
|
||||
<xsl:for-each select="./c:set">
|
||||
<xsl:for-each select="c:set|c:vector">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>\\</xsl:text>
|
||||
</xsl:if>
|
||||
|
|
Loading…
Reference in New Issue