Split news archive into separate files per year
All checks were successful
the build was successful

This commit is contained in:
Reinhard Müller 2019-03-12 00:53:16 +01:00
parent 07ac7e3d34
commit 0c6e202a69
6 changed files with 202 additions and 46 deletions

6
.gitignore vendored
View File

@ -7,5 +7,11 @@ tools/.texts-??.xml
.fundraising.??.xml
.*.xmllist
tags/tagged-*.en.xhtml
events/????/????.??.xhtml
events/????/????.sources
events/????/????.xsl
news/????/????.??.xhtml
news/????/????.sources
news/????/????.xsl
news/*/.*.??.xml
about/printable/archive/printable.en.xml

View File

@ -1,7 +1,6 @@
news/*/news:[frontpage]
news/*/.news:[frontpage]
events/*/event:[frontpage]
news/2019/news:[frontpage]
news/2019/.news:[frontpage]
events/2019/event:[frontpage]
tools/frontpage/:[]
d_day:[]
tools/static-elements/element-:[]

View File

@ -1,11 +1,50 @@
# -----------------------------------------------------------------------------
# Makefile to generate includeable .xml files from .xhtml news pages
# Makefile for FSFE website build, preparation for news subdirectory
# -----------------------------------------------------------------------------
.PHONY: all
.SECONDEXPANSION:
# -----------------------------------------------------------------------------
# Remove .xml files where original .xhtml file does not exist anymore
# Copy news archive template to each of the years
# -----------------------------------------------------------------------------
# All years for which a subdirectory exists
ARCH_YEARS := $(sort $(wildcard [0-9][0-9][0-9][0-9]))
# No archive for the current year
ARCH_YEARS := $(filter-out $(lastword $(ARCH_YEARS)),$(ARCH_YEARS))
# Languages in which the template exists
ARCH_LANGS := $(suffix $(basename $(wildcard archive-template.??.xhtml)))
# .xhtml files to generate
ARCH_XHTML := $(foreach year,$(ARCH_YEARS),$(foreach lang,$(ARCH_LANGS),$(year)/$(year)$(lang).xhtml))
all: $(ARCH_XHTML)
$(ARCH_XHTML): %.xhtml: archive-template$$(suffix $$*).xhtml
@echo "* Updating $@"
@# $(dir $@) returns YYYY/, we abuse the slash for closing the sed command
@sed 's/:YYYY:/$(dir $@)g' $< > $@
# .sources files to generate
ARCH_SOURCES := $(foreach year,$(ARCH_YEARS),$(year)/$(year).sources)
all: $(ARCH_SOURCES)
$(ARCH_SOURCES): %.sources:
@echo "* Creating $@"
@echo "news/$(dir $@)news-*:[]\nnews/$(dir $@).news-*:[]\nlocalmenuinfo:[]\n" > $@
# .xsl files to generate
ARCH_XSL := $(foreach year,$(ARCH_YEARS),$(year)/$(year).xsl)
all: $(ARCH_XSL)
$(ARCH_XSL): %.xsl: news.xsl
@echo "* Creating $@"
@sed -r 's/(import href=")/\1..\//; s/(\.\.\/about)/..\/\1/' $< > $@
# -----------------------------------------------------------------------------
# Remove generated .xml files where original .xhtml file does not exist anymore
# -----------------------------------------------------------------------------
# note the reversal of target <-> prerequisite relationship
# make will execute thew command for all xhtml files (targets) that
@ -27,8 +66,6 @@ all: $(GENERATED_XML_SOURCES)
# Generate .xml files from .xhtml files
# -----------------------------------------------------------------------------
.SECONDEXPANSION:
# All existing .xhtml files
XHTML := $(shell ls */*.??.xhtml | xargs grep -l '<html newsdate')

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<html>
<head>
<title>News Archive for :YYYY: - FSFE</title>
</head>
<body class="article" microformats="h-entry">
<div class="news-follow-us">
<div class="share-top-buttons-label">Follow us:</div>
<div class="share-buttons-top">
<a target="_blank" href="https://fsfe.org/news/newsletter">
<button class="share-button-top share-mail">Newsletter</button>
</a>
<a target="_blank" href="https://fsfe.org/news/news.en.rss">
<button class="share-button-top share-rss">RSS Feed</button>
</a>
<a target="_blank" href="https://mastodon.social/@fsfe">
<button class="share-button-top share-mastodon">Mastodon</button>
</a>
<a target="_blank" href="https://diasp.eu/u/fsfe">
<button class="share-button-top share-diaspora">Diaspora</button>
</a>
<a target="_blank" href="https://twitter.com/fsfe">
<button class="share-button-top share-twitter">Twitter</button>
</a>
<a target="_blank" href="https://facebook.com/thefsfe">
<button class="share-button-top share-facebook">Facebook</button>
</a>
</div>
</div>
<localmenu set="year" style="number" id=":YYYY:">:YYYY:</localmenu>
<h1 class="p-name">News Archive for :YYYY:</h1>
<include-news/>
</body>
<sidebar promo="none">
<div class="news-sidebar">
<h2>Follow our News</h2>
<p>
To keep up with our latest news, subscribe to our
<a href="/news/news.en.rss">RSS feed</a> and our
<a href="/news/newsletter">Newsletter</a>.
</p>
<div class="share-buttons-sidebar">
<a target="_blank" href="https://fsfe.org/news/newsletter">
<button class="share-button-sidebar share-mail">Newsletter</button>
</a>
<a target="_blank" href="https://fsfe.org/news/news.en.rss">
<button class="share-button-sidebar share-rss">RSS Feed</button>
</a>
</div>
<h2>Social Media</h2>
<p>
For short news follow us on
<a href="https://mastodon.social/@fsfe">Mastodon</a>,
<a href="https://diasp.eu/u/fsfe">Diaspora</a>,
<a href="https://twitter.com/fsfe">Twitter</a>, and
<a href="https://facebook.com/thefsfe">Facebook</a>.
</p>
<div class="share-buttons-sidebar">
<a target="_blank" href="https://mastodon.social/@fsfe">
<button class="share-button-sidebar share-mastodon">Mastodon</button>
</a>
<a target="_blank" href="https://diasp.eu/u/fsfe">
<button class="share-button-sidebar share-diaspora">Diaspora</button>
</a><br/>
<a target="_blank" href="https://twitter.com/fsfe">
<button class="share-button-sidebar share-twitter">Twitter</button>
</a>
<a target="_blank" href="https://facebook.com/thefsfe">
<button class="share-button-sidebar share-facebook">Facebook</button>
</a>
</div>
</div>
</sidebar>
</html>

View File

@ -1,37 +1,64 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="UTF-8"?>
<html>
<head>
<title>News Archive FSFE</title>
<title>News - FSFE</title>
</head>
<body class="article" microformats="h-entry">
<div class="news-follow-us">
<div class="share-top-buttons-label">Follow us:</div>
<div class="share-buttons-top">
<a target="_blank" href="https://fsfe.org/news/newsletter">
<button class="share-button-top share-mail">Newsletter</button>
</a>
<a target="_blank" href="https://fsfe.org/news/news.en.rss">
<button class="share-button-top share-rss">RSS Feed</button>
</a>
<a target="_blank" href="https://mastodon.social/@fsfe">
<button class="share-button-top share-mastodon">Mastodon</button>
</a>
<a target="_blank" href="https://diasp.eu/u/fsfe">
<button class="share-button-top share-diaspora">Diaspora</button>
</a>
<a target="_blank" href="https://twitter.com/fsfe">
<button class="share-button-top share-twitter">Twitter</button>
</a>
<a target="_blank" href="https://facebook.com/thefsfe">
<button class="share-button-top share-facebook">Facebook</button>
</a>
<div class="news-follow-us">
<div class="share-top-buttons-label">Follow us:</div>
<div class="share-buttons-top">
<a target="_blank" href="https://fsfe.org/news/newsletter">
<button class="share-button-top share-mail">Newsletter</button>
</a>
<a target="_blank" href="https://fsfe.org/news/news.en.rss">
<button class="share-button-top share-rss">RSS Feed</button>
</a>
<a target="_blank" href="https://mastodon.social/@fsfe">
<button class="share-button-top share-mastodon">Mastodon</button>
</a>
<a target="_blank" href="https://diasp.eu/u/fsfe">
<button class="share-button-top share-diaspora">Diaspora</button>
</a>
<a target="_blank" href="https://twitter.com/fsfe">
<button class="share-button-top share-twitter">Twitter</button>
</a>
<a target="_blank" href="https://facebook.com/thefsfe">
<button class="share-button-top share-facebook">Facebook</button>
</a>
</div>
</div>
</div>
<h1 class="p-name">News</h1>
<include-news/>
<h2>News archives</h2>
<p>
For older news items, please see our news archives:
</p>
<div class="btn-group" role="group">
<a class="btn btn-default" href="2017">2017</a>
<a class="btn btn-default" href="2016">2016</a>
<a class="btn btn-default" href="2015">2015</a>
<a class="btn btn-default" href="2014">2014</a>
<a class="btn btn-default" href="2013">2013</a>
<a class="btn btn-default" href="2012">2012</a>
<a class="btn btn-default" href="2011">2011</a>
<a class="btn btn-default" href="2010">2010</a>
<a class="btn btn-default" href="2009">2009</a>
<a class="btn btn-default" href="2008">2008</a>
<a class="btn btn-default" href="2007">2007</a>
<a class="btn btn-default" href="2006">2006</a>
<a class="btn btn-default" href="2005">2005</a>
<a class="btn btn-default" href="2004">2004</a>
<a class="btn btn-default" href="2003">2003</a>
<a class="btn btn-default" href="2002">2002</a>
<a class="btn btn-default" href="2001">2001</a>
</div>
</body>
<sidebar promo="none">
@ -39,8 +66,9 @@
<h2>Follow our News</h2>
<p>
To keep up with our latest news, subscribe to our <a href="/news/news.en.rss">RSS feed</a> and
our <a href="/news/newsletter">Newsletter</a>.
To keep up with our latest news, subscribe to our
<a href="/news/news.en.rss">RSS feed</a> and our
<a href="/news/newsletter">Newsletter</a>.
</p>
<div class="share-buttons-sidebar">
@ -52,13 +80,14 @@
</a>
</div>
<h2>Social Media</h2>
<p>
For short news follow us on <a
href="https://mastodon.social/@fsfe">Mastodon</a>, <a href="https://diasp.eu/u/fsfe">Diaspora</a>, <a
href="https://twitter.com/fsfe">Twitter</a> and <a href="https://facebook.com/thefsfe">Facebook</a>.
For short news follow us on
<a href="https://mastodon.social/@fsfe">Mastodon</a>,
<a href="https://diasp.eu/u/fsfe">Diaspora</a>,
<a href="https://twitter.com/fsfe">Twitter</a>, and
<a href="https://facebook.com/thefsfe">Facebook</a>.
</p>
<div class="share-buttons-sidebar">
@ -79,10 +108,6 @@
<hr/>
<static-element id="video" />
</div>
</sidebar>
<text id="more">Read more…</text>
<timestamp>$Date$ $Author$</timestamp>
</html>

View File

@ -1,5 +1,9 @@
news/*/news:[]
news/*/.news:[]
news/nl/nl:[]
news/nl/.nl:[]
news/2019/news:[]
news/2019/.news:[]
news/nl/nl-2019:[]
news/nl/.nl-2019:[]
news/2018/news:[]
news/2018/.news:[]
news/nl/nl-2018:[]
news/nl/.nl-2018:[]
tools/static-elements/element-:[]