about summary refs log tree commit diff
path: root/doc/html.xslt
diff options
context:
space:
mode:
Diffstat (limited to 'doc/html.xslt')
-rw-r--r--doc/html.xslt63
1 files changed, 63 insertions, 0 deletions
diff --git a/doc/html.xslt b/doc/html.xslt
new file mode 100644
index 0000000..5ad48ad
--- /dev/null
+++ b/doc/html.xslt
@@ -0,0 +1,63 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:rub="https://rub.parody" extension-element-prefixes="rub">
+  <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
+  <xsl:template match="*"><rub:eval/></xsl:template>
+
+  <xsl:template match="/rub:page">
+    <html lang="en">
+      <head>
+        <meta charset="utf-8"/>
+        <meta name="color-scheme" content="dark light"/>
+        <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
+        <xsl:if test="rub:description != ''">
+          <meta name="description" content="{rub:description}"/>
+        </xsl:if>
+        <link rel="alternate" type="application/atom+xml" href="/index.xml"/>
+        <link rel="icon" href="/karderio-Toy-baloon.svg"/>
+        <link rel="stylesheet" href="/style.css"/>
+        <title><xsl:value-of select="rub:title"/></title>
+      </head>
+      <body>
+        <header>
+          <div class="blog-name"><a href="/">Rub</a></div>
+          <nav>
+            <ul>
+              <li><a href="/demo">Demoes</a></li>
+            </ul>
+          </nav>
+        </header>
+        <main>
+          <h1><xsl:value-of select="rub:title"/></h1>
+          <xsl:apply-templates select="rub:markdown"/>
+        </main>
+        <xsl:if test="boolean(rub:category)">
+          <small class="tags">
+            <strong>Tags:</strong>
+            <xsl:for-each select="rub:category">
+              <xsl:text> </xsl:text>
+              <a href="/tag/{.}"><xsl:value-of select="."/></a>
+            </xsl:for-each>
+          </small>
+          <br/>
+        </xsl:if>
+        <footer>
+          Copyright and stuff
+        </footer>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="h2|h3|h4|h5|h6">
+    <xsl:element name="{name()}">
+      <xsl:attribute name="id">
+        <xsl:value-of select="text()"/>
+      </xsl:attribute>
+      <a href="#{text()}"><xsl:value-of select="."/></a>
+    </xsl:element>
+  </xsl:template>
+
+  <!-- Remove paragraph inside footnote list item -->
+  <xsl:template match="li[starts-with(@id, 'fn-')]/p">
+    <xsl:copy-of select='@*|node()'/>
+  </xsl:template>
+</xsl:stylesheet>