changed the style of the news archive and added author, tags and new sidebar style

This commit is contained in:
sansusann 2017-12-31 22:17:48 +01:00
parent e0b56da3d0
commit 7d5a1e83f2
5 changed files with 288 additions and 197 deletions

View File

@ -1,59 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="sidebar">
<xsl:element name="aside">
<xsl:attribute name="id">sidebar</xsl:attribute>
<xsl:template name="sidebar">
<aside id="sidebar">
<xsl:if test="string(/buildinfo/document/@newsdate) and /buildinfo/document/@type = 'newsletter'">
<xsl:element name="h3">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'receive-newsletter'" />
</xsl:call-template>
</xsl:element>
<h3><xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'receive-newsletter'" />
</xsl:call-template></h3>
<xsl:call-template name="subscribe-nl" />
<ul><li><a href="/news/newsletter.html">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'news/nl'" />
</xsl:call-template>
</a></li><li><a href="/news/news.html">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'news/news'" />
</xsl:call-template>
</a></li><li><a href="/events/events.html">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'news/events'" />
</xsl:call-template>
</a></li><li><a href="http://planet.fsfe.org">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'news/planet'" />
</xsl:call-template>
</a></li><li><a href="/contact/community.html">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'community/discuss'" />
</xsl:call-template>
</a></li></ul>
<ul>
<li><a href="/news/newsletter.html">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'news/nl'" />
</xsl:call-template></a></li>
<li><a href="/news/news.html">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'news/news'" />
</xsl:call-template></a></li>
<li><a href="/events/events.html">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'news/events'" />
</xsl:call-template></a></li>
<li><a href="http://planet.fsfe.org">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'news/planet'" />
</xsl:call-template></a></li>
<li><a href="/contact/community.html">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'community/discuss'" />
</xsl:call-template></a></li>
</ul>
</xsl:if>
<xsl:if test="string(/buildinfo/document/@newsdate) and count(/buildinfo/document/@type) = 0">
<h3><xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'fsfe/press'" />
</xsl:call-template></h3>
<ul><li><a href="/press/press.html">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'news/press'" />
</xsl:call-template>
</a></li><li><a href="/news/news.html">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'news/news'" />
</xsl:call-template>
</a></li><li><a href="/about/basics/freesoftware.html">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'fs/basics'" />
</xsl:call-template>
</a></li></ul>
<ul>
<li><a href="/press/press.html">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'news/press'" />
</xsl:call-template></a></li>
<li><a href="/news/news.html">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'news/news'" />
</xsl:call-template></a></li>
<li><a href="/about/basics/freesoftware.html">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'fs/basics'" />
</xsl:call-template></a></li>
</ul>
</xsl:if>
<xsl:apply-templates select="/buildinfo/document/sidebar/node()" />
@ -66,56 +63,62 @@
</a>
</xsl:if>
<xsl:choose><xsl:when test = "/buildinfo/document/sidebar/@promo = 'our-work'">
<h3 class="promo"><xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'our-work'" />
</xsl:call-template></h3>
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'our-work-intro'" />
</xsl:call-template>
<a href="/work.html" class="learn-more"><xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'learn-more'" />
</xsl:call-template></a>
</xsl:when><xsl:when test = "/buildinfo/document/sidebar/@promo = 'about-fsfe'">
<h3 class="promo"><xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'about-fsfe'" />
</xsl:call-template></h3>
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'about-fsfe-intro'" />
</xsl:call-template>
<a href="/about/about.html" class="learn-more"><xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'learn-more'" />
</xsl:call-template></a>
</xsl:when><xsl:when test = "/buildinfo/document/sidebar/@promo = 'donate'">
<h3 class="promo"><xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'donate'" />
</xsl:call-template></h3>
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'donate-paragraph'" />
</xsl:call-template>
<a href="/donate/donate.html#ref-sidebar" class="learn-more big-donate">
<xsl:choose>
<xsl:when test = "/buildinfo/document/sidebar/@promo = 'our-work'">
<h3 class="promo"><xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'our-work'" />
</xsl:call-template></h3>
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'donate'" />
<xsl:with-param name="id" select="'our-work-intro'" />
</xsl:call-template>
</a>
<a href="/work.html" class="learn-more">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'learn-more'" />
</xsl:call-template></a>
<!--otherwise display about-fsfe-->
</xsl:when><xsl:when test = "not(/buildinfo/document/sidebar/@promo = 'no')">
<h3 class="promo"><xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'about-fsfe'" />
</xsl:call-template></h3>
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'about-fsfe-intro'" />
</xsl:call-template>
<a href="/about/about.html" class="learn-more"><xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'learn-more'" />
</xsl:call-template></a>
</xsl:when></xsl:choose>
</xsl:element>
<!--/aside#sidebar-->
</xsl:when><xsl:when test = "/buildinfo/document/sidebar/@promo = 'about-fsfe'">
<h3 class="promo"><xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'about-fsfe'" />
</xsl:call-template></h3>
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'about-fsfe-intro'" />
</xsl:call-template>
<a href="/about/about.html" class="learn-more">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'learn-more'" />
</xsl:call-template></a>
</xsl:when><xsl:when test = "/buildinfo/document/sidebar/@promo = 'donate'">
<h3 class="promo"><xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'donate'" />
</xsl:call-template></h3>
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'donate-paragraph'" />
</xsl:call-template>
<a href="/donate/donate.html#ref-sidebar" class="learn-more big-donate">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'donate'" />
</xsl:call-template></a>
<!-- empty sidebar -->
</xsl:when><xsl:when test = "/buildinfo/document/sidebar/@promo = 'none'">
<!--otherwise display about-fsfe-->
</xsl:when><xsl:when test = "not(/buildinfo/document/sidebar/@promo = 'no')">
<h3 class="promo"><xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'about-fsfe'" />
</xsl:call-template></h3>
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'about-fsfe-intro'" />
</xsl:call-template>
<a href="/about/about.html" class="learn-more">
<xsl:call-template name="fsfe-gettext">
<xsl:with-param name="id" select="'learn-more'" />
</xsl:call-template></a>
</xsl:when>
</xsl:choose>
</aside>
</xsl:template>
</xsl:stylesheet>

View File

@ -391,7 +391,35 @@ img.signatory-logo {
margin-right: 10px;
}
/* news archive */
.archivenews h3 { line-height: 1.2em; }
.archivenews p { font-size: 0.9em; }
ul.archivemeta, ul.archivetaglist {
color: #999;
font-size: 0.9em;
padding-left: 0;
}
ul.archivemeta li {
display: inline-block;
padding: 0 0.15em;
}
ul.archivetaglist li {
display: inline-block;
padding: 0 0.25em;
}
ul.archivemeta li:first-child {padding-left: 0; }
ul.archivemeta li a, ul.archivetaglist li a { color: #999; }
.archiveauthor { margin: 0 0.25em; }
ul.archivetaglist { margin-left: 6%; }
/* donate */

View File

@ -4,28 +4,17 @@
<head>
<title>News Archive FSFE</title>
</head>
<body>
<h1>News Archive</h1>
<p id="introduction">
This page collects the regular news stories that FSFE publishes
about its campaigns and activities. Join the <a
href="/press/index.html">press release mailing list</a> or
subscribe to <a href="/news/news.rss">our RSS feed</a> to keep
up-to-date on our activites. <a href="newsletter.html">Monthly
newsletters</a> are also available. Worldwide Free Software news is
available from FSFE's <a href="/about/fsfnetwork.html">sister
organisations</a>.
</p>
<body class="article" microformats="h-entry">
<h1 class="p-name">News</h1>
<include-news/>
</body>
<sidebar promo="none">
<h2><i class="fa fa-rss"></i></h2>
<p>This page collects the regular news stories that FSFE publishes about its campaigns and activities. <br />Join the <a href="/press/index.html">press release mailing list</a> or subscribe to <a href="/news/news.rss">our RSS feed</a> to keep up-to-date on our activites. <a href="newsletter.html">Monthly newsletters</a> are also available.</p>
</sidebar>
<text id="more">Read more…</text>
<timestamp>$Date$ $Author$</timestamp>
</html>
<!--
Local Variables: ***
mode: xml ***
End: ***
-->
</html>

View File

@ -1,59 +1,129 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dt="http://xsltsl.org/date-time">
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />
<xsl:import href="../tools/xsltsl/date-time.xsl" />
<xsl:output method="html"
encoding="utf-8"
indent="yes"
doctype-system="about:legacy-compat" />
<!-- In /html/body node, append dynamic content -->
<!-- in /html/body node, append dynamic content -->
<xsl:template match="/buildinfo/document/body/include-news">
<!-- First, include what's in the source file -->
<xsl:apply-templates />
<!-- first, include what's in the source file -->
<xsl:apply-templates />
<!-- $today = current date (given as <html date="...">) -->
<xsl:variable name="today">
<xsl:value-of select="/buildinfo/@date" />
</xsl:variable>
<!-- $today = current date (given as <html date="...">) -->
<xsl:variable name="today">
<xsl:value-of select="/buildinfo/@date" />
</xsl:variable>
<!-- show news except those in the future, but no newsletters -->
<xsl:for-each select="/buildinfo/document/set/news
[translate (@date, '-', '') &lt;= translate ($today, '-', '')
and not (@type = 'newsletter')]">
<xsl:sort select="@date" order="descending" />
<!-- Show news except those in the future, but no newsletters -->
<xsl:for-each select="/buildinfo/document/set/news
[translate (@date, '-', '') &lt;= translate ($today, '-', '') and
not (@type = 'newsletter')]">
<xsl:sort select="@date" order="descending" />
<!-- This is a news entry -->
<xsl:element name="p">
<!-- Date and title -->
<xsl:element name="b">
<xsl:text>(</xsl:text>
<xsl:value-of select="@date" />
<xsl:text>) </xsl:text>
<!-- begin: news entry -->
<section class="archivenews">
<!-- title (linked) -->
<h3><xsl:choose><xsl:when test="link != ''">
<a href="{link}"><xsl:value-of select="title" /></a>
</xsl:when><xsl:otherwise>
<xsl:value-of select="title" />
</xsl:element>
<xsl:element name="br" />
<!-- Text -->
<xsl:apply-templates select="body/node()" />
<!-- Link -->
<xsl:apply-templates select="link" />
</xsl:element>
<!-- End news entry -->
</xsl:for-each>
</xsl:otherwise></xsl:choose></h3>
<!-- date and author -->
<ul class="archivemeta">
<li> <!-- date -->
<xsl:value-of select="substring(@date,9,2)" />
<xsl:text> </xsl:text>
<xsl:call-template name="dt:get-month-name">
<xsl:with-param name="month" select="substring(@date,6,2)" />
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:value-of select="substring(@date,1,4)" />
</li> <!-- author -->
<xsl:if test="/buildinfo/document/set/news/author">
<xsl:apply-templates select="author" />
</xsl:if></ul>
<!-- text and read-more-link -->
<p><xsl:apply-templates select="body/node()" />
<xsl:apply-templates select="link" /></p>
<!-- tags -->
<xsl:if test="/buildinfo/document/set/news/tags/tag
[not(. = 'front-page' or @key = 'front-page')]">
<ul class="archivetaglist"><xsl:apply-templates select="tags" /></ul>
</xsl:if>
</section>
<!-- end: news entry -->
</xsl:for-each>
</xsl:template>
<!-- How to show a link -->
<!-- how to display: author -->
<xsl:template match="buildinfo/document/set/news/author">
<xsl:variable name="id" select="@id" />
<xsl:if test="position() = 1">
<li class="archiveauthor"><xsl:text>&#x2014;</xsl:text></li>
</xsl:if>
<li> <!-- 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>
</li>
</xsl:template>
<!-- how to display: read-more-link -->
<xsl:template match="/buildinfo/document/set/news/link">
<xsl:text>&#160;</xsl:text>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="text()" />
</xsl:attribute>
<xsl:attribute name="class">learn-more</xsl:attribute>
<xsl:value-of select="/buildinfo/document/text[@id='more']" />
</xsl:element>
<a class="learn-more" href="{text()}"></a>
</xsl:template>
</xsl:stylesheet>
<!-- how to display: tags -->
<xsl:template match="buildinfo/document/set/news/tags">
<xsl:for-each select="tag[not(. = 'front-page' or @key = 'front-page')]">
<xsl:variable name="keyname"
select="translate(@key,'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_+ /','abcdefghijklmnopqrstuvwxyz')" />
<xsl:variable name="tagname"
select="translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_+ /','abcdefghijklmnopqrstuvwxyz')" />
<xsl:choose>
<xsl:when test="@key and .">
<li><a href="/tags/tagged-{$keyname}.html"><xsl:value-of select="." /></a></li>
</xsl:when><xsl:when test="@content and not(@content = '')"><!-- Legacy -->
<li><a href="/tags/tagged-{$tagname}.html"><xsl:value-of select="@content" /></a></li>
</xsl:when><xsl:when test="@key"><!-- bad style -->
<li><a href="/tags/tagged-{$keyname}.html"><xsl:value-of select="@key" /></a></li>
</xsl:when><xsl:otherwise><!-- Legacy and bad style -->
<li><a href="/tags/tagged-{$tagname}.html"><xsl:value-of select="." /></a></li>
</xsl:otherwise></xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

View File

@ -9,53 +9,54 @@
<xsl:template match="/html">
<xsl:element name="newsset">
<xsl:element name="news">
<xsl:attribute name="date">
<xsl:value-of select="/html/@newsdate"/>
</xsl:attribute>
<xsl:if test="/html/@type">
<xsl:attribute name ="type">
<xsl:value-of select="/html/@type"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="date">
<xsl:value-of select="/html/@newsdate"/>
</xsl:attribute>
<xsl:if test="/html/@type">
<xsl:attribute name ="type">
<xsl:value-of select="/html/@type"/>
</xsl:attribute>
</xsl:if>
<!-- TODO: to be removed -->
<xsl:if test="/html/@tags">
<xsl:attribute name ="tags">
<xsl:value-of select="/html/@tags"/>
</xsl:attribute>
</xsl:if>
<!-- TODO: to be removed -->
<xsl:if test="/html/@tags">
<xsl:attribute name ="tags">
<xsl:value-of select="/html/@tags"/>
</xsl:attribute>
</xsl:if>
<xsl:element name="title">
<xsl:value-of select="/html/head/title"/>
</xsl:element>
<xsl:element name="title">
<xsl:value-of select="/html/head/title"/>
</xsl:element>
<xsl:element name="body">
<xsl:value-of select="/html/body/p[@newsteaser]"/>
</xsl:element>
<xsl:element name="body">
<xsl:value-of select="/html/body/p[@newsteaser]"/>
</xsl:element>
<xsl:element name="body-complete">
<xsl:copy-of select="/html/body/node()"/>
</xsl:element>
<xsl:element name="body-complete">
<xsl:copy-of select="/html/body/node()"/>
</xsl:element>
<xsl:element name="link">
<xsl:variable name="the_link">
<xsl:value-of select="/html/@link"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="not(string($the_link))">
<xsl:value-of select="$link"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$the_link"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
<xsl:copy-of select="/html/tags" />
<xsl:element name="link">
<xsl:variable name="the_link">
<xsl:value-of select="/html/@link"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="not(string($the_link))">
<xsl:value-of select="$link"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$the_link"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
<xsl:copy-of select="/html/tags" />
<xsl:copy-of select="/html/author" />
</xsl:element>
</xsl:element>
</xsl:template>