paritybit.ca

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit fa583d1504b06f2f1c698198298e5784ab376548
parent e8d81fdf3c1b24b5e99a6bb62db5a764c5c08a30
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Sun,  7 Jun 2020 22:28:08 -0400

Add script to generate listing for blogroll page

Diffstat:
Agenerate-blogroll.sh | 41+++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+), 0 deletions(-)

diff --git a/generate-blogroll.sh b/generate-blogroll.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +# generate-blogroll +# A POSIX shell script to generate the blogroll list for paritybit.ca. +# NOTE: See the README for the expected format of md files. +# +# Copyright (C) 2020 Jake Bauer +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +# POSIX Shell "Strict Mode" +set -o errexit +set -o nounset +IFS=$(printf '\n\t') + +feed_list=$(newsboat -e | grep outline) + +> blogroll-unsorted.md + +for item in $feed_list; do + xml_url=$(echo "$item" | awk '{print $3}' | cut -d'=' -f2- | tr -d \") + http_url=$(echo "$item" | awk '{print $4}' | cut -d'=' -f2- | tr -d \") + title=$(echo "$item" | awk '{$1=$2=$3=$4=""; print $0}' | cut -d'=' -f2- | tr -d \" | sed -E 's/\/>$//') + echo "* [$title]($http_url) ([feed]($xml_url))" >> blogroll-unsorted.md +done + +sort blogroll-unsorted.md > blogroll.md +rm blogroll-unsorted.md + +exit 0