From c9291830d07f2cf3b02a08cd76b798796ea2997a Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Tue, 7 Jun 2022 09:39:32 -0700 Subject: [PATCH] Automatically pull webring links during build --- .build.yml | 1 + .gitignore | 1 + Makefile | 5 +- csv/{webrings.csv => webrings.base.csv} | 1 - scripts/populate-webrings.sh | 84 +++++++++++++++++++++++++ scripts/xhtmlize-single-file.sh | 1 + 6 files changed, 91 insertions(+), 2 deletions(-) rename csv/{webrings.csv => webrings.base.csv} (93%) create mode 100755 scripts/populate-webrings.sh diff --git a/.build.yml b/.build.yml index 7426726..b3b59d2 100644 --- a/.build.yml +++ b/.build.yml @@ -4,6 +4,7 @@ # hugo, brotli, ect (like gzip/zopfli), sd, and xmlfmt. image: alpine/edge packages: + - curl # for webring update script - rsync - git # for Hugo's gitInfo - bmake diff --git a/.gitignore b/.gitignore index 8b23cde..7aaaa17 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ old/ public/ public_*/ .hugo_build.lock +csv/webrings.csv diff --git a/Makefile b/Makefile index 29d1f07..8a8de1b 100644 --- a/Makefile +++ b/Makefile @@ -19,8 +19,11 @@ ECT_LEVEL=9 VNU ?= vnu +csv/webrings.csv: + sh scripts/populate-webrings.sh + .PHONY: hugo -hugo: $(SRCFILES) +hugo: csv/webrings.csv $(SRCFILES) hugo -b $(HUGO_BASEURL) $(HUGO_FLAGS) -d $(OUTPUT_DIR) # .hintrc-local for linting local files diff --git a/csv/webrings.csv b/csv/webrings.base.csv similarity index 93% rename from csv/webrings.csv rename to csv/webrings.base.csv index e1b0606..512b67d 100644 --- a/csv/webrings.csv +++ b/csv/webrings.base.csv @@ -6,7 +6,6 @@ no js webring,https://nojs.sugarfi.dev/prev.php?url=https://seirdy.one,https://n Fediring,https://fediring.net/previous?host=seirdy.one,https://fediring.net/,https://fediring.net/next?host=seirdy.one Loop (JS),https://graycot.com/webring/loop-redirect.html?action=prev,https://graycot.com/webring/,https://graycot.com/webring/loop-redirect.html?action=next YesterWeb,https://webring.yesterweb.org/noJS/index.php?d=prev&url=https://seirdy.one/,https://yesterweb.org/webring/,https://webring.yesterweb.org/noJS/index.php?d=next&url=https://seirdy.one/ -GEORGE,https://aroace.space,https://george.gh0.pw,http://truttle1.xyz/truttlecities/~Itzzy/MainStreet/index.html Retronaut,https://webring.dinhe.net/prev/https://seirdy.one,https://webring.dinhe.net/,https://webring.dinhe.net/next/https://seirdy.one Hotline,https://hotlinewebring.club/seirdy/previous,https://hotlinewebring.club,https://hotlinewebring.club/seirdy/next Bucket (JS),https://webring.bucketfish.me/redirect.html?to=prev&name=seirdy,https://webring.bucketfish.me/,https://webring.bucketfish.me/redirect.html?to=next&name=seirdy diff --git a/scripts/populate-webrings.sh b/scripts/populate-webrings.sh new file mode 100755 index 0000000..5d6a7eb --- /dev/null +++ b/scripts/populate-webrings.sh @@ -0,0 +1,84 @@ +#!/bin/sh + +# Get webring links to append to the CSV before building + +# Some webrings require an iframe or scripts, but I want a plain static +# first-party HTML+CSS page. This script fetches webring links by +# parsing the iframes and appends appropriate values to my webrings.csv file. + +set -e -u + + +# the name of this program +progname="$(basename "$0")" +dirname="$(dirname "$0")" + +webrings_src="$dirname/../csv/webrings.base.csv" +webrings_dest="$dirname/../csv/webrings.csv" + +help_text="Usage: $progname [OPTION...] + +Update webrings.csv with new prev/next links, to avoid iframes/scripts + +Options: + -h Print this help and exit + -d Dry run; just print results, don't update webrings.csv +" + +usage() { + printf '%s' "$help_text" +} + +# when the user passess bad args, send a msg to stderr and exit +# usage: bad_option