about summary refs log tree commit diff
path: root/doc/html.xslt
blob: 5ad48add6bdc304edb254190169b60d17b68ab15 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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>