summaryrefslogtreecommitdiff
path: root/tools/xml-to-html.xsl
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2024-02-15 13:38:56 +0300
committerdefanor <defanor@uberspace.net>2024-02-15 18:22:22 +0300
commitc5ee134dbb53f9bc40d717dbc09b209807988084 (patch)
tree3cda3cca43d5f3af0b60439cd441eb482a4ad65f /tools/xml-to-html.xsl
parent5e8080a223d8414814032c7e3fde4e9547eacbc0 (diff)
Merge the phlog into the website
Now supporting file listings, which are used for blog posts, and generating a gophermap with their index.
Diffstat (limited to 'tools/xml-to-html.xsl')
-rw-r--r--tools/xml-to-html.xsl36
1 files changed, 28 insertions, 8 deletions
diff --git a/tools/xml-to-html.xsl b/tools/xml-to-html.xsl
index 5785c7e..96c94c8 100644
--- a/tools/xml-to-html.xsl
+++ b/tools/xml-to-html.xsl
@@ -82,19 +82,18 @@
<xsl:apply-templates mode="body" select="xhtml:body/@*" />
<xsl:apply-templates mode="body" select="xhtml:body/*" />
<footer>
+ defanor, <a
+ href="https://creativecommons.org/licenses/by-sa/4.0/">CC
+ BY-SA 4.0</a>,
<xsl:if test="not(//notes) and @created and @modified">
- defanor, <a
- href="https://creativecommons.org/licenses/by-sa/4.0/">CC
- BY-SA 4.0</a>, <time><xsl:copy-of
- select="substring(@created,0,8)" /></time> <xsl:if
- test="substring(@created,0,8) !=
+ <time><xsl:copy-of select="substring(@created,0,8)"
+ /></time> <xsl:if test="substring(@created,0,8) !=
substring(@modified,0,8)"> to <time><xsl:copy-of
- select="substring(@modified,0,8)" /></time></xsl:if>, at
- <a
+ select="substring(@modified,0,8)" /></time></xsl:if>,
+ </xsl:if>at <a
href="https://defanor.uberspace.net/">defanor.uberspace.net</a>
or <a
href="https://www.thunix.net/~defanor/">thunix.net/~defanor</a>
- </xsl:if>
</footer>
</body>
</html>
@@ -141,6 +140,27 @@
</dd>
</xsl:template>
+ <xsl:template mode="body" match="files">
+ <xsl:variable name="files" select="document(@src)" />
+ <xsl:variable name="number" select="@number" />
+ <ul>
+ <xsl:apply-templates mode="file-index"
+ select="$files/files/file[$number=0 or position()&lt;=$number]">
+ <xsl:with-param name="prefix"
+ select="@prefix" />
+ </xsl:apply-templates>
+ </ul>
+ </xsl:template>
+
+ <xsl:template mode="file-index" match="file">
+ <xsl:param name="prefix" />
+ <li>
+ <a href="{$prefix}/{@src}">
+ <xsl:value-of select="@src" />
+ </a>
+ </li>
+ </xsl:template>
+
<xsl:template mode="body" match="xhtml:h1|xhtml:h2|xhtml:h3|xhtml:h4|xhtml:h5">
<xsl:copy>
<xsl:attribute name="id">