diff options
author | Nguyễn Gia Phong <cnx@loang.net> | 2023-10-21 06:29:39 +0900 |
---|---|---|
committer | Nguyễn Gia Phong <cnx@loang.net> | 2023-10-21 06:29:39 +0900 |
commit | 11bfc0b7c7ba43708c90f43ac3bd2e6f61d800ad (patch) | |
tree | 075ec4c96e3742ab59a7e204884f2db5efc1ca5e /_assets | |
parent | 2f2883337c8d5611741bb96345417b04fbe46625 (diff) | |
download | site-11bfc0b7c7ba43708c90f43ac3bd2e6f61d800ad.tar.gz |
Update listing pages
Diffstat (limited to '_assets')
-rw-r--r-- | _assets/feed.xslt | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/_assets/feed.xslt b/_assets/feed.xslt new file mode 100644 index 0000000..15817d2 --- /dev/null +++ b/_assets/feed.xslt @@ -0,0 +1,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> |