about summary refs log tree commit diff homepage
path: root/_assets/feed.xslt
blob: 15817d220cee0100d91fb3b2cc91a9409b1bd8e2 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version='3.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
  <xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>
  <xsl:template match='pubDate'>
    <xsl:value-of select='substring(., 13, 4)'/>
    <xsl:text>-</xsl:text>
    <xsl:choose>
      <xsl:when test='contains(., "Jan")'>01</xsl:when>
      <xsl:when test='contains(., "Feb")'>02</xsl:when>
      <xsl:when test='contains(., "Mar")'>03</xsl:when>
      <xsl:when test='contains(., "Apr")'>04</xsl:when>
      <xsl:when test='contains(., "May")'>05</xsl:when>
      <xsl:when test='contains(., "Jun")'>06</xsl:when>
      <xsl:when test='contains(., "Jul")'>07</xsl:when>
      <xsl:when test='contains(., "Aug")'>08</xsl:when>
      <xsl:when test='contains(., "Sep")'>09</xsl:when>
      <xsl:when test='contains(., "Oct")'>10</xsl:when>
      <xsl:when test='contains(., "Nov")'>11</xsl:when>
      <xsl:when test='contains(., "Dec")'>12</xsl:when>
    </xsl:choose>
    <xsl:text>-</xsl:text>
    <xsl:value-of select='format-number(substring(., 6, 2), "00")'/>
  </xsl:template>

  <xsl:template match='item'>
    <xsl:param name='space'/>
    <xsl:if test='category = $space'>
      <li>
        <a href='{substring(link, 1, string-length(link)-11)}'
           title='{description}'>
          <xsl:value-of select='title'/>
        </a>
        <xsl:text>. </xsl:text>
        <time><xsl:apply-templates select='pubDate'/></time>
        <xsl:text>. </xsl:text>
        <small>
          <xsl:for-each select='category'>
            <xsl:if test='. != $space'>
              <xsl:text> </xsl:text>
              <a class='tag' href='/tag/{.}'>
                <xsl:value-of select='.'/>
              </a>
            </xsl:if>
          </xsl:for-each>
        </small>
      </li>
    </xsl:if>
  </xsl:template>

  <xsl:template match="/">
    <xsl:variable name='home' select='link'/>
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta charset='utf-8'/>
        <meta name='color-scheme' content='dark light'/>
        <meta name='viewport' content='width=device-width, initial-scale=1'/>
        <link rel='stylesheet' href='/css/style.css'/>
        <link rel='icon' href='/assets/favicon.svg'/>
        <title><xsl:value-of select='/rss/channel/title'/></title>
      </head>
      <body>
        <header>
          <div class='blog-name'><a href='/'>McSinyx</a></div>
          <nav>
            <ul>
              <li><a href='/works'>Portfolio</a></li>
              <li><a href='/blog'>Blogs</a></li>
            </ul>
          </nav>
        </header>
        <main class='franklin-content'>
          <h1>Web Logs</h1>
          <p>I occasionally blog about functional programming
            and other computational stuff, or anything related
            to computers in general.  These write-ups are tagged
            as <a class='tag' href='/tag/fun'>fun</a>.</p>
          <ol reversed='reversed'>
            <xsl:apply-templates select='/rss/channel/item'>
              <xsl:with-param name='space' select='"fun"'/>
            </xsl:apply-templates>
          </ol>
          <p>I sometimes note what happens in meatspace as well.
            Such writings might still have a thing or two to do with computing
            (given it is integrated into my life) and they are tagged
            as <a class='tag' href='/tag/lyf'>lyf</a>.</p>
          <ol reversed='reversed'>
            <xsl:apply-templates select='/rss/channel/item'>
              <xsl:with-param name='space' select='"lyf"'/>
            </xsl:apply-templates>
          </ol>
          <p>The page you are viewing is an RSS feed.  How cool is that?</p>
          <h2>See Also</h2>
          <xsl:copy-of select='document("/assets/fead.xhtml")'/>
          <small class='right'>Generated by
            <a href='https://trong.loang.net/~cnx/fead'>fead</a></small>
        </main>
        <footer>
          <xsl:value-of select='/rss/channel/copyright'/>
        </footer>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>