#!/usr/bin/env bash HEADING='Posts' TITLE="Andrea's blog" BASENAME=${BASENAME-blog} BASE_URL=${BASE_URL-https://sqt.wtf} DESCRIPTION="Andrea's personal blog." N_DESC_CHARS=500 articles=( $BASENAME/*.md ) cat <

$HEADING

HDR cat > blog/feed.xml < $TITLE $BASE_URL/$BASENAME.html $DESCRIPTION RSSHDR for ((i=${#articles[@]}-1; i>=0; i--)); do post_md=${articles[$i]} date=$(grep -o '[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}' <<<"$post_md") title=$(grep -m 1 '^#\s\+' "$post_md" | sed 's/^#\s\+//') html=$(sed 's/\.md$/.html/' <<<"$post_md") rss_desc=$(grep -v '^\s*$' "$post_md" | grep -v '^\s*\*by' | grep -v '^#' | grep -v '^\s*!\[' | grep -v '<.\+>'| head -c $N_DESC_CHARS)'...' cat <$date
$title
INNIE cat >> $BASENAME/feed.xml < $title $BASE_URL/~targetdisk/$html $rss_desc $(date -d "$date" '+%a, %d %b %Y %H:%M:%S %Z') RSSINNIE done cat <

RSS

FTR # #

Other People's Posts

# {{range .Articles}} #
#

# {{.Title}} #

#

{{.Summary}}

# # via {{.SourceTitle}} # # {{.Date | datef "January 2, 2006"}} #
# {{end}} # #

# #

# Generated by # openring #

#
# # # #FTR cat >> $BASENAME/feed.xml < RSSFTR