From 456817fb58099de41330edafbc2c23df1f30792c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20M=C3=BCller?= Date: Wed, 13 Mar 2019 00:26:26 +0100 Subject: [PATCH] Add support for $thisyear and $lastyear in *.sources --- donate/thankgnus.sources | 4 ++-- index.sources | 8 +++++--- news/news.sources | 16 ++++++++-------- tools/update_xmllists.sh | 7 +++++++ 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/donate/thankgnus.sources b/donate/thankgnus.sources index ae73ebb58d..076e5f611b 100644 --- a/donate/thankgnus.sources +++ b/donate/thankgnus.sources @@ -1,4 +1,4 @@ -donate/donors/donors-2018:[] -donate/donors/donors-2019:[] +donate/donors/donors-$thisyear:[] +donate/donors/donors-$lastyear:[] localmenuinfo:[] d_day:[] diff --git a/index.sources b/index.sources index 40d2e9f75a..6ca0298dd8 100644 --- a/index.sources +++ b/index.sources @@ -1,5 +1,7 @@ -news/2019/news:[frontpage] -news/2019/.news:[frontpage] -events/2019/event:[frontpage] +news/$thisyear/news:[frontpage] +news/$lastyear/news:[frontpage] +news/$thisyear/.news:[frontpage] +news/$lastyear/.news:[frontpage] +events/$thisyear/event:[frontpage] tools/frontpage/:[] tools/static-elements/element-:[] diff --git a/news/news.sources b/news/news.sources index 636135c136..4425e1ae32 100644 --- a/news/news.sources +++ b/news/news.sources @@ -1,9 +1,9 @@ -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:[] +news/$thisyear/news:[] +news/$lastyear/news:[] +news/$thisyear/.news:[] +news/$lastyear/.news:[] +news/nl/nl-$thisyear:[] +news/nl/nl-$lastyear:[] +news/nl/.nl-$thisyear:[] +news/nl/.nl-$lastyear:[] tools/static-elements/element-:[] diff --git a/tools/update_xmllists.sh b/tools/update_xmllists.sh index 1d3e193465..6efaf7789b 100755 --- a/tools/update_xmllists.sh +++ b/tools/update_xmllists.sh @@ -27,6 +27,9 @@ set -o pipefail pid=$$ +thisyear=$(date --date="this year" +%Y) +lastyear=$(date --date="last year" +%Y) + # ----------------------------------------------------------------------------- # Make sure temporary directory is empty # ----------------------------------------------------------------------------- @@ -101,6 +104,10 @@ for source_file in $(find * -name '*.sources' | sort); do continue fi + # Honor $thisyear and $lastyear variables + pattern=${pattern//\$thisyear/${thisyear}} + pattern=${pattern//\$lastyear/${lastyear}} + # Change from a glob pattern into a regex pattern=$(echo "${pattern}" | sed -r -e 's/([.^$[])/\\\1/g; s/\*/.*/g')