justin.deal/public/rss/styles.xsl
2025-05-04 15:33:23 -07:00

302 lines
8.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><xsl:value-of select="/rss/channel/title"/> RSS Feed</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<style type="text/css">
/* Gruvbox Theme Variables */
:root {
/* Light theme (default) */
--color-zag-dark: #282828;
--color-zag-light: #ebdbb2;
--color-zag-dark-muted: #928374;
--color-zag-light-muted: #504945;
--color-zag-accent-light: #b8bb26;
--color-zag-accent-dark: #fe8019;
--color-zag-accent-dark-muted: #fabd2f;
--color-zag-bg: rgba(235, 219, 178, 0.8);
--color-zag-bg-hover: rgba(235, 219, 178, 1);
--font-mono: "IBM Plex Mono", ui-monospace, monospace;
--font-display: "press-start-2p", ui-monospace, monospace;
--zag-stroke: 2px;
--zag-offset: 6px;
--transition-medium: 300ms;
--ease-default: cubic-bezier(0.4, 0, 0.2, 1);
}
/* Transitions and animations */
.zag-transition {
transition:
background-color var(--transition-medium) var(--ease-default),
color var(--transition-medium) var(--ease-default),
border-color var(--transition-medium) var(--ease-default);
}
/* Basic elements */
body {
font-family: var(--font-mono);
line-height: 1.6;
color: var(--color-zag-dark);
background-color: var(--color-zag-light);
max-width: 900px;
margin: 0 auto;
padding: 2rem 1rem;
transition: color 0.5s var(--ease-default),
background-color 0.5s var(--ease-default);
}
h1 {
font-family: var(--font-display);
font-size: 1.5rem;
margin: 0;
line-height: 1.4;
color: var(--color-zag-dark);
}
h2 {
font-size: 1.25rem;
margin: 0;
color: var(--color-zag-dark);
line-height: 1.4;
}
/* Header section */
.header {
padding: 2rem 0;
border-bottom: var(--zag-stroke) solid var(--color-zag-dark);
margin-bottom: 2rem;
}
.header p {
margin: 0.5rem 0 0;
color: var(--color-zag-dark-muted);
}
.description {
color: var(--color-zag-dark-muted);
font-size: 1rem;
margin: 1rem 0;
}
/* Item styling */
.item {
padding: 1.5rem 0;
border-bottom: 1px solid var(--color-zag-dark-muted);
transition: transform 0.2s ease;
}
.item:hover {
transform: translateY(-2px);
}
.item:last-child {
border-bottom: none;
}
.item-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
}
.pub-date {
color: var(--color-zag-dark-muted);
font-size: 0.875rem;
margin: 0;
flex-shrink: 0;
}
.item-title {
margin: 0;
flex-grow: 1;
margin-right: 1.5rem;
}
.item-title a {
color: var(--color-zag-accent-dark);
text-decoration: none;
position: relative;
}
.item-title a:hover {
text-decoration: underline;
text-underline-offset: var(--zag-offset);
}
.item-description {
margin: 0.75rem 0 0;
}
/* Category tags */
.categories {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin-top: 1rem;
}
.category {
background-color: var(--color-zag-accent-light);
color: var(--color-zag-dark);
border-radius: 0.25rem;
padding: 0.25rem 0.75rem;
font-size: 0.75rem;
font-family: var(--font-mono);
}
/* Footer section */
.footer {
padding: 2rem 0 0;
border-top: var(--zag-stroke) solid var(--color-zag-dark);
margin-top: 2rem;
display: flex;
justify-content: space-between;
color: var(--color-zag-dark-muted);
font-size: 0.875rem;
}
.footer a {
color: var(--color-zag-accent-dark);
text-decoration: none;
}
.footer a:hover {
text-decoration: underline;
text-underline-offset: var(--zag-offset);
}
/* Dark mode */
@media (prefers-color-scheme: dark) {
body {
background-color: var(--color-zag-dark);
color: var(--color-zag-light);
}
h1, h2 {
color: var(--color-zag-light);
}
.header {
border-bottom-color: var(--color-zag-light);
}
.header p, .description, .pub-date {
color: var(--color-zag-light-muted);
}
.item {
border-bottom-color: var(--color-zag-light-muted);
}
.footer {
border-top-color: var(--color-zag-light);
color: var(--color-zag-light-muted);
}
.category {
background-color: var(--color-zag-accent-dark);
color: var(--color-zag-dark);
}
}
/* Responsive adjustments */
@media (max-width: 640px) {
body {
padding: 1.5rem 1rem;
}
h1 {
font-size: 1.25rem;
}
h2 {
font-size: 1.125rem;
}
.item {
padding: 1.25rem 0;
}
.item-header {
flex-direction: column;
}
.pub-date {
margin-top: 0.5rem;
}
}
</style>
</head>
<body>
<div class="header">
<h1><xsl:value-of select="/rss/channel/title"/></h1>
<p class="description"><xsl:value-of select="/rss/channel/description"/></p>
<p>
<a>
<xsl:attribute name="href">
<xsl:value-of select="/rss/channel/link"/>
</xsl:attribute>
Visit Website &#8594;
</a>
</p>
</div>
<div class="items">
<xsl:for-each select="/rss/channel/item">
<div class="item">
<div class="item-header">
<h2 class="item-title">
<a>
<xsl:attribute name="href">
<xsl:value-of select="link"/>
</xsl:attribute>
<xsl:value-of select="title"/>
</a>
</h2>
<p class="pub-date">
<xsl:value-of select="substring(pubDate, 6, 11)"/>
</p>
</div>
<p class="item-description">
<xsl:value-of select="description"/>
</p>
<xsl:if test="category">
<div class="categories">
<xsl:for-each select="category">
<span class="category">
<xsl:value-of select="."/>
</span>
</xsl:for-each>
</div>
</xsl:if>
</div>
</xsl:for-each>
</div>
<div class="footer">
<p>
<a>
<xsl:attribute name="href">
<xsl:value-of select="/rss/channel/link"/>
</xsl:attribute>
<xsl:value-of select="/rss/channel/title"/>
</a>
</p>
<p>
<a href="https://validator.w3.org/feed/check.cgi">
<xsl:attribute name="href">
<xsl:value-of select="concat('https://validator.w3.org/feed/check.cgi?url=', /rss/channel/link, '/rss.xml')"/>
</xsl:attribute>
Validate RSS
</a>
</p>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>