aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2016-05-30 23:09:18 +0200
committerAdrian Kummerlaender2016-05-30 23:09:18 +0200
commitea80a43687e815db161f836e733c280615f98adc (patch)
treef65b6d4b5e7e6baf8086739ffb103bf711f885aa
parente8a1bd91bff586fb6b0f4b6ac2384cc004f0e276 (diff)
downloadblog.kummerlaender.eu-ea80a43687e815db161f836e733c280615f98adc.tar
blog.kummerlaender.eu-ea80a43687e815db161f836e733c280615f98adc.tar.gz
blog.kummerlaender.eu-ea80a43687e815db161f836e733c280615f98adc.tar.bz2
blog.kummerlaender.eu-ea80a43687e815db161f836e733c280615f98adc.tar.lz
blog.kummerlaender.eu-ea80a43687e815db161f836e733c280615f98adc.tar.xz
blog.kummerlaender.eu-ea80a43687e815db161f836e733c280615f98adc.tar.zst
blog.kummerlaender.eu-ea80a43687e815db161f836e733c280615f98adc.zip
Link footnotes in article stream to appropriate single article page
Previously multiple footnotes on article stream pages caused conflicts between articles and as such only worked correctly for the first article on each stream page.
-rw-r--r--source/99_result/stream.xsl20
-rw-r--r--utility/xhtml.xsl4
2 files changed, 22 insertions, 2 deletions
diff --git a/source/99_result/stream.xsl b/source/99_result/stream.xsl
index 5469ff4..19fc539 100644
--- a/source/99_result/stream.xsl
+++ b/source/99_result/stream.xsl
@@ -59,6 +59,26 @@
</div>
</xsl:template>
+<xsl:template match="a" mode="xhtml">
+ <xsl:choose>
+ <xsl:when test="(@class = 'footnote') or (@class = 'reversefootnote')">
+ <xsl:element name="{local-name()}" namespace="http://www.w3.org/1999/xhtml">
+ <xsl:copy-of select="@class"/>
+ <xsl:attribute name="href">
+ <xsl:value-of select="concat('/article/', ancestor::entry/@handle, '/', @href)"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="node()" mode="xhtml"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="{local-name()}" namespace="http://www.w3.org/1999/xhtml">
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates select="node()" mode="xhtml"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
<xsl:template match="articles/entry" mode="resolve">
<h2>
<xsl:text>ยป </xsl:text>
diff --git a/utility/xhtml.xsl b/utility/xhtml.xsl
index 2f54975..00f1ef2 100644
--- a/utility/xhtml.xsl
+++ b/utility/xhtml.xsl
@@ -12,13 +12,13 @@
</xsl:template>
<xsl:template match="span" mode="xhtml">
- <span>
+ <xsl:element name="{local-name()}" namespace="http://www.w3.org/1999/xhtml">
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="node()" mode="xhtml"/>
<xsl:if test="not(node())">
<xsl:comment></xsl:comment>
</xsl:if>
- </span>
+ </xsl:element>
</xsl:template>
<xsl:template match="comment() | processing-instruction()" mode="xhtml">