website-doc: order announces by date

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2016-07-22 17:21:13 +02:00
parent 284c66b04a
commit 63f0622d41
1 changed files with 22 additions and 9 deletions

View File

@ -11,6 +11,7 @@ DOCBASE="${WEBSITE}/_doc"
DESTBASE="${DOCBASE}/versions"
VERSIONS_YML="${WEBSITE}/_data/versions.yml"
ANNOUNCES_YML="${WEBSITE}/_data/announces.yml"
ANNOUNCES_YML_TMP="${ANNOUNCES_YML}.tmp"
CONTRIB_YML="${WEBSITE}/_data/contribs.yml"
CONTRIB="${DOCBASE}/contrib"
HEADER="# DO NOT EDIT MANUALLY: it is generated by a script (website-doc.sh)."
@ -67,10 +68,10 @@ function api () {
# $1: full release title
#
function parse_releases_get_link () {
echo $1 | sed -r -e 's,^### (OfflineIMAP.*)\),\1,' \
| tr '[:upper:]' '[:lower:]' \
| sed -r -e 's,[\.("],,g' \
| sed -r -e 's, ,-,g'
echo $1 | sed -r -e 's,^### (OfflineIMAP.*)\),\1,' \
| tr '[:upper:]' '[:lower:]' \
| sed -r -e 's,[\.("],,g' \
| sed -r -e 's, ,-,g'
}
#
@ -78,7 +79,15 @@ function parse_releases_get_link () {
# $1: full release title
#
function parse_releases_get_version () {
echo $title | sed -r -e 's,^### [a-Z]+ (v[^ ]+).*,\1,'
echo $title | sed -r -e 's,^### [a-Z]+ (v[^ ]+).*,\1,'
}
#
# Return date from release entry.
# $1: full release title
#
function parse_releases_get_date () {
echo $title | sed -r -e 's,.*\(([0-9]+-[0-9]+-[0-9]+)\),\1,'
}
#
@ -100,15 +109,19 @@ function releases () {
do
link="$(parse_releases_get_link $title)"
v="$(parse_releases_get_version $title)"
echo "- {version: '${v}', link: 'Changelog.html#${link}'}"
done | tee -a "$ANNOUNCES_YML"
d="$(parse_releases_get_date $title)"
echo "- {date: '${d}', version: '${v}', link: 'Changelog.html#${link}'}"
done | tee -a "$ANNOUNCES_YML_TMP"
# Announces for the maintenance releases.
grep -E '^### OfflineIMAP' ./Changelog.maint.md | while read title
do
link="$(parse_releases_get_link $title)"
v="$(parse_releases_get_version $title)"
echo "- {version: '${v}', link: 'Changelog.maint.html#${link}'}"
done | tee -a "$ANNOUNCES_YML"
d="$(parse_releases_get_date $title)"
echo "- {date: '${d}', version: '${v}', link: 'Changelog.maint.html#${link}'}"
done | tee -a "$ANNOUNCES_YML_TMP"
sort -nr "$ANNOUNCES_YML_TMP" >> "$ANNOUNCES_YML"
rm -f "$ANNOUNCES_YML_TMP"
}