diff options
Diffstat (limited to 'tools/xml-to-html.xsl')
-rw-r--r-- | tools/xml-to-html.xsl | 60 |
1 files changed, 46 insertions, 14 deletions
diff --git a/tools/xml-to-html.xsl b/tools/xml-to-html.xsl index 261397f..96c94c8 100644 --- a/tools/xml-to-html.xsl +++ b/tools/xml-to-html.xsl @@ -68,25 +68,32 @@ <!-- The rest is fixed metadata --> <link property="dc:creator schema:creator foaf:maker sioc:has_creator" href="https://defanor.uberspace.net/about.xhtml#me" /> + <link property="dc:creator schema:creator foaf:maker sioc:has_creator" + href="https://www.thunix.net/~defanor/about.xhtml#me" /> + <link property="dc:license schema:license" + href="https://creativecommons.org/licenses/by-sa/4.0/" /> <link property="dc:isPartOf schema:isPartOf sioc:has_container" href="https://defanor.uberspace.net/" /> - <style> - body { max-width: 86ch; margin: auto; padding: 0ch 1ch 1ch 1ch; - background: #061014; color: #c0d0d6; } - img { max-width: 84ch; } - a { color: #60b0a0; } - a:visited { color: #60a0b0; } - </style> + <link property="dc:isPartOf schema:isPartOf sioc:has_container" + href="https://www.thunix.net/~defanor/" /> <meta name="robots" content="noarchive" /> </head> <body> + <xsl:apply-templates mode="body" select="xhtml:body/@*" /> <xsl:apply-templates mode="body" select="xhtml:body/*" /> <footer> - <xsl:if test="not(//notes)"> - <a href="https://defanor.uberspace.net/">defanor</a>, - <time><xsl:copy-of select="substring(@created,0,8)" /></time> - <xsl:if test="substring(@created,0,8) != substring(@modified,0,8)">–<time><xsl:copy-of select="substring(@modified,0,8)" /></time></xsl:if> - </xsl:if> + 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"> + <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>, + </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> </footer> </body> </html> @@ -125,10 +132,35 @@ <dd> <xsl:value-of select="document/@description" /> (<time><xsl:copy-of select="substring(document/@created,0,8)" /></time> - <xsl:if test="substring(document/@created,0,8) != substring(document/@modified,0,8)">–<time><xsl:copy-of select="substring(document/@modified,0,8)" /></time></xsl:if>) + <xsl:if test="substring(document/@created,0,8) != substring(document/@modified,0,8)"> to <time><xsl:copy-of select="substring(document/@modified,0,8)" /></time></xsl:if>, + <xsl:value-of select= + "string-length(normalize-space(document)) - + string-length(translate(normalize-space(document), ' ', '')) + + 1" /> words) </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()<=$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"> @@ -139,7 +171,7 @@ </xsl:copy> </xsl:template> - <xsl:template mode="body" match="node()" priority="0"> + <xsl:template mode="body" match="@* | node()" priority="-1"> <xsl:copy> <xsl:copy-of select="@*" /> <xsl:apply-templates mode="body" /> |