From 995643cae1238ab3d3b21ae36ac666625d741afa Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 27 Dec 2023 00:42:28 +0100 Subject: Added atom feed for the content The entries are not yet ordered, placement in the index is... questionable, and the content of "published-on" and "last-modified-on" is duplicated in the subtitle line. --- atom.xml.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 atom.xml.sh (limited to 'atom.xml.sh') diff --git a/atom.xml.sh b/atom.xml.sh new file mode 100755 index 0000000..157a924 --- /dev/null +++ b/atom.xml.sh @@ -0,0 +1,47 @@ +#!/bin/sh +now () { + date --rfc-3339=seconds | sed 's/ /T/' +} + + +meta () { + perl -nle '// && print $1' "$2" +} + + +dates () { + local published=$(meta "published-on" "$1") + local modified=$(git rev-list --after="2023-12-27 00:45+01:00" -1 --no-commit-header --pretty=%aI HEAD -- "$1") + [ -z "$modified" ] && modified=$(meta "last-modified-on" "$1") + [ -z "$modified" ] && modified=$published + echo "$modified" + echo "$published" +} + + +cat <
+ +~aki +https://ignore.pl/ +$(now) + +https://ignore.pl/favicon.png + +aki +please@ignore.pl + +HEADER +for article in [^_]*.html; do + if [ "$article" != "index.html" ]; then + cat <<-ENTRY + + $(grep "" $article) + <id>https://ignore.pl/$article</id> + <link href="https://ignore.pl/$article"/> + $(dates $article) + </entry> +ENTRY + fi +done +echo "</feed>" -- cgit v1.1