Skip to content

Commit

Permalink
linking to terms for issue #55
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcarlisle committed Oct 7, 2017
1 parent 522a8fa commit 1b66a01
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 23 deletions.
3 changes: 2 additions & 1 deletion omstd20.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ editing environments.

<!ELEMENT volumenum (#PCDATA)>

<!ENTITY % phrasetext "#PCDATA|xref|ulink|citation|varname|filename
<!ENTITY % phrasetext "#PCDATA|xref|term|ulink|citation|varname|filename
|acronym|systemitem|quote|phrase|emphasis|math">

<!ELEMENT para (%phrasetext;|orderedlist|variablelist|itemizedlist
Expand Down Expand Up @@ -251,6 +251,7 @@ editing environments.
<!ELEMENT varlistentry (term+,listitem)*>

<!ELEMENT term (%phrasetext;)*>
<!ATTLIST term id CDATA #IMPLIED>

<!-- docbook tables -->

Expand Down
3 changes: 2 additions & 1 deletion omstd20.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ volumenum = element volumenum {text}

id = attribute id {text}

phrasetext = (text|xref|ulink|citation|varname|filename|acronym|systemitem|quote|phrase|emphasis|math)*
phrasetext = (text|xref|term|ulink|citation|varname|filename|acronym|systemitem|quote|phrase|emphasis|math)*

para = element para {
id?,
Expand Down Expand Up @@ -265,6 +265,7 @@ varlistentry = element varlistentry{
}

term = element term {
id?,
phrasetext
}

Expand Down
40 changes: 29 additions & 11 deletions xsl/omstd20.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -595,12 +595,16 @@ relative to the OpenMath 2.0 document...</p>
</dd>
</xsl:template>

<xsl:template match="varlistentry/term">
<xsl:template match="varlistentry/term" priority="2">
<dt>
<xsl:apply-templates select="../@*|node()"/>
<xsl:apply-templates select="../@*,@*,node()"/>
</dt>
</xsl:template>

<xsl:template match="term[@id]" priority="1">
<span id="{@id}"><xsl:apply-templates/></span>
</xsl:template>

<xsl:template match="varname">
<b><xsl:apply-templates/></b>
</xsl:template>
Expand Down Expand Up @@ -665,15 +669,23 @@ count="figure[not(ancestor-or-self::*/@revisionflag='deleted')]" level="any" fr
</xsl:if>
</xsl:variable>
<a href="{lower-case($c)}#{@linkend}">
<xsl:choose>
<xsl:when test="$n/ancestor::appendix">Appendix</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(substring(name($n),1,1),'acfs','ACFS')"/>
<xsl:value-of select="substring(name($n),2)"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>&#160;</xsl:text>
<xsl:apply-templates mode="number" select="$n"/>
<xsl:choose>
<xsl:when test="$n/self::term">
<xsl:attribute name="class" select="'termref'"/>
<xsl:apply-templates select="$n/node()"/>
</xsl:when>
<xsl:when test="$n/ancestor::appendix">
<xsl:text>Appendix</xsl:text>
<xsl:text>&#160;</xsl:text>
<xsl:apply-templates mode="number" select="$n"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(substring(name($n),1,1),'acfs','ACFS')"/>
<xsl:value-of select="substring(name($n),2)"/>
<xsl:text>&#160;</xsl:text>
<xsl:apply-templates mode="number" select="$n"/>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:template>

Expand Down Expand Up @@ -822,6 +834,12 @@ changelog entry here
</xsl:if>
</xsl:template>

<xsl:template match="@id">
<xsl:copy-of select="."/>
</xsl:template>





<xsl:template match="entry">
Expand Down
31 changes: 21 additions & 10 deletions xsl/omstd20tex.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,15 @@ relative to the OpenMath 1.0 document\ldots
<xsl:apply-templates select="../@*|node()"/>
</xsl:template>

<xsl:template match="varlistentry/term">
\item[<xsl:apply-templates select="../@*|node()"/>]
<xsl:template match="varlistentry/term" priority="2">
\item[<xsl:apply-templates select="../@*,@*,node()"/>]
</xsl:template>

<xsl:template match="term[@id]" priority="1">
<xsl:apply-templates/>
</xsl:template>


<xsl:template match="varname">
<xsl:text/>\textbf£<xsl:apply-templates/>ß<xsl:text/>
</xsl:template>
Expand Down Expand Up @@ -430,15 +435,21 @@ relative to the OpenMath 1.0 document\ldots
<xsl:template match="xref">
<xsl:variable name="n" select="key('ids',@linkend)"/>
<xsl:choose>
<xsl:when test="$n/ancestor::appendix">Appendix</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(substring(name($n),1,1),'acfs','ACFS')"/>
<xsl:value-of select="substring(name($n),2)"/>
</xsl:otherwise>
<xsl:when test="$n/self::term">
<xsl:apply-templates select="$n/node()"/>
</xsl:when>
<xsl:when test="$n/ancestor::appendix">
<xsl:text>Appendix</xsl:text>
<xsl:text>&#160;</xsl:text>
<xsl:text/>\ref£<xsl:value-of select="@linkend"/>ß<xsl:text/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(substring(name($n),1,1),'acfs','ACFS')"/>
<xsl:value-of select="substring(name($n),2)"/>
<xsl:text>&#160;</xsl:text>
<xsl:text/>\ref£<xsl:value-of select="@linkend"/>ß<xsl:text/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>&#160;</xsl:text>
<!--<xsl:apply-templates mode="number" select="$n"/>-->
<xsl:text/>\ref£<xsl:value-of select="@linkend"/>ß<xsl:text/>
</xsl:template>

<xsl:template match="programlisting|literallayout">
Expand Down

0 comments on commit 1b66a01

Please sign in to comment.