Files
fsfe-website/fsfe.org/news/default.xsl
delliott d1614ded53
All checks were successful
continuous-integration/drone/push Build is passing
feat/newsletter-overview (#5630)
Should solve #5623

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5630
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2026-02-03 11:37:42 +00:00

125 lines
5.2 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="../fsfe.xsl"/>
<!-- ==================================================================== -->
<!-- Display the author(s) of the news item -->
<!-- ==================================================================== -->
<xsl:template match="buildinfo/document/set/news/author">
<xsl:variable name="id" select="@id"/>
<!-- if author is in fsfe's people.xml, take information from there -->
<xsl:choose>
<!-- author is in people.en.xml -->
<xsl:when test="@id and document('../about/people/people.en.xml')/personset/person[@id=$id]">
<xsl:choose>
<!-- person has a link -->
<xsl:when test="document('../about/people/people.en.xml')/personset/person[@id=$id]/link">
<a rel="author" href="{document('../about/people/people.en.xml')/personset/person[@id=$id]/link}">
<xsl:value-of select="document('../about/people/people.en.xml')/personset/person[@id=$id]/name"/>
</a>
</xsl:when>
<!-- person has no link -->
<xsl:otherwise>
<span>
<xsl:value-of select="document('../about/people/people.en.xml')/personset/person[@id=$id]/name"/>
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- author is not in people.en.xml -->
<xsl:otherwise>
<xsl:choose>
<!-- person has a link -->
<xsl:when test="link">
<a rel="author" href="{link}">
<xsl:value-of select="name"/>
</a>
</xsl:when>
<!-- person has no link -->
<xsl:otherwise>
<span class="author p-author">
<xsl:value-of select="name"/>
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(position() = last())">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:template>
<!-- ==================================================================== -->
<!-- Display a single news item -->
<!-- ==================================================================== -->
<xsl:template match="news">
<!-- Wrap the news item into an <article> -->
<xsl:element name="article">
<xsl:attribute name="class">news with-image-left</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="@filename"/>
</xsl:attribute>
<!-- Image -->
<xsl:call-template name="news-image">
<xsl:with-param name="shrink" select="'yes'"/>
</xsl:call-template>
<xsl:element name="div">
<xsl:attribute name="class">news-inner</xsl:attribute>
<!-- Title with or without link -->
<xsl:element name="h3">
<xsl:call-template name="news-title"/>
</xsl:element>
<!-- Date and author -->
<xsl:element name="p">
<xsl:attribute name="class">meta</xsl:attribute>
<xsl:call-template name="news-date"/>
<xsl:if test="author">
<xsl:text> </xsl:text>
<xsl:apply-templates select="author"/>
</xsl:if>
</xsl:element>
<!-- Text and "read-more" link -->
<xsl:call-template name="news-teaser"/>
<!-- Tags -->
<xsl:apply-templates select="tags"/>
</xsl:element>
<!-- /div -->
</xsl:element>
</xsl:template>
<!-- ==================================================================== -->
<!-- Display a verbose list of news items -->
<!-- ==================================================================== -->
<xsl:template match="include-news">
<!-- Loop through all news items except those in the future -->
<xsl:for-each select="/buildinfo/document/set/news[ translate(@date, '-', '') &lt;= translate(/buildinfo/@date, '-', '') ]">
<xsl:sort select="@date" order="descending"/>
<!-- Before every 5 news, show a banner, depending on even or odd number of position in loop -->
<xsl:if test="position() mod 5 = 0">
<xsl:choose>
<!-- even number -->
<xsl:when test="position() mod 2 = 0">
<xsl:apply-templates select="/buildinfo/document/banner1/node()"/>
</xsl:when>
<!-- odd number -->
<xsl:otherwise>
<xsl:apply-templates select="/buildinfo/document/banner2/node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<!-- Display the news items -->
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Follow for more information -->
<xsl:template match="more-updates">
<p>
<xsl:call-template name="gettext">
<xsl:with-param name="id" select="'more-updates'"/>
</xsl:call-template>
</p>
<div class="module-wrapper news">
<xsl:apply-templates select="/buildinfo/document/banner1/node()"/>
<xsl:apply-templates select="/buildinfo/document/follow-news/node()"/>
<xsl:apply-templates select="/buildinfo/document/social-media/node()"/>
</div>
</xsl:template>
</xsl:stylesheet>