1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-23 17:52:15 -05:00

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

16
xep.xsl
View File

@ -643,7 +643,21 @@ content: "XEP-<xsl:value-of select='/xep/header/number'/>";
<xsl:template match='spec'> <xsl:template match='spec'>
<xsl:param name='speccount' select='""'/> <xsl:param name='speccount' select='""'/>
<xsl:variable name='specpos' select='position()'/> <xsl:variable name='specpos' select='position()'/>
<xsl:value-of select='.'/> <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:if test='$specpos &lt; $speccount'>
<xsl:text>, </xsl:text> <xsl:text>, </xsl:text>
</xsl:if> </xsl:if>