From 043338995fdff9003701ed92502cecef4f59392c Mon Sep 17 00:00:00 2001 From: kageru Date: Mon, 4 May 2020 20:15:48 +0200 Subject: [PATCH] Replace rss feed with atom --- blog-refresh.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/blog-refresh.sh b/blog-refresh.sh index 6a260c9..9063674 100755 --- a/blog-refresh.sh +++ b/blog-refresh.sh @@ -13,18 +13,17 @@ output_rss() { add_header() { output '

Blog index

' output_rss ' - - + + kageru kageru’s blog' - output_rss " $blog_domain + output_rss " kageru’s blog" } add_footer() { html_entry "legacy" "before 2020" "Older posts" output '' - output_rss ' -' + output_rss '' } html_entry() { @@ -37,11 +36,18 @@ html_entry() { } rss_entry() { - output_rss " + # The content is the output minus the first line + # (which would otherwise be a redundant title in most rss readers) + # and with escaped html. + # The sed expression is stolen from https://stackoverflow.com/questions/12873682/12873723#12873723 + output_rss " $1 $blog_domain$2 - $1 - " + + + $(tail -n+2 "$2" | sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g') + + " } create_entry() {