xep.xsl: Linkify RFCs and XEP references

This commit is contained in:
Jonas Schäfer 2022-01-19 17:54:27 +01:00
parent 3f5fd31323
commit 00ea099c7a
1 changed files with 15 additions and 1 deletions

14
xep.xsl
View File

@ -643,7 +643,21 @@ content: "XEP-<xsl:value-of select='/xep/header/number'/>";
<xsl:template match='spec'>
<xsl:param name='speccount' select='""'/>
<xsl:variable name='specpos' select='position()'/>
<xsl:variable name='spec' select='translate(string(.), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")'/>
<xsl:choose>
<xsl:when test='starts-with($spec, "xep-")'><a>
<xsl:attribute name="href"><xsl:value-of select="$spec"/>.html</xsl:attribute>
<xsl:value-of select='.'/>
</a></xsl:when>
<xsl:when test='starts-with($spec, "rfc ")'>
<xsl:variable name='rfcno' select='substring-after($spec, "rfc ")'/>
<a>
<xsl:attribute name="href">https://datatracker.ietf.org/doc/html/rfc<xsl:value-of select="$rfcno"/></xsl:attribute>
<xsl:value-of select='.'/>
</a>
</xsl:when>
<xsl:otherwise><xsl:value-of select='.'/></xsl:otherwise>
</xsl:choose>
<xsl:if test='$specpos &lt; $speccount'>
<xsl:text>, </xsl:text>
</xsl:if>