mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-10 00:12:09 +00:00
Automatically pull webring links during build
This commit is contained in:
parent
c87a67c5de
commit
c9291830d0
6 changed files with 91 additions and 2 deletions
|
@ -4,6 +4,7 @@
|
||||||
# hugo, brotli, ect (like gzip/zopfli), sd, and xmlfmt.
|
# hugo, brotli, ect (like gzip/zopfli), sd, and xmlfmt.
|
||||||
image: alpine/edge
|
image: alpine/edge
|
||||||
packages:
|
packages:
|
||||||
|
- curl # for webring update script
|
||||||
- rsync
|
- rsync
|
||||||
- git # for Hugo's gitInfo
|
- git # for Hugo's gitInfo
|
||||||
- bmake
|
- bmake
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,3 +10,4 @@ old/
|
||||||
public/
|
public/
|
||||||
public_*/
|
public_*/
|
||||||
.hugo_build.lock
|
.hugo_build.lock
|
||||||
|
csv/webrings.csv
|
||||||
|
|
5
Makefile
5
Makefile
|
@ -19,8 +19,11 @@ ECT_LEVEL=9
|
||||||
|
|
||||||
VNU ?= vnu
|
VNU ?= vnu
|
||||||
|
|
||||||
|
csv/webrings.csv:
|
||||||
|
sh scripts/populate-webrings.sh
|
||||||
|
|
||||||
.PHONY: hugo
|
.PHONY: hugo
|
||||||
hugo: $(SRCFILES)
|
hugo: csv/webrings.csv $(SRCFILES)
|
||||||
hugo -b $(HUGO_BASEURL) $(HUGO_FLAGS) -d $(OUTPUT_DIR)
|
hugo -b $(HUGO_BASEURL) $(HUGO_FLAGS) -d $(OUTPUT_DIR)
|
||||||
|
|
||||||
# .hintrc-local for linting local files
|
# .hintrc-local for linting local files
|
||||||
|
|
|
@ -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
|
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
|
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/
|
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
|
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
|
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
|
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
|
|
84
scripts/populate-webrings.sh
Executable file
84
scripts/populate-webrings.sh
Executable file
|
@ -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 <option> <reason>
|
||||||
|
bad_option() {
|
||||||
|
echo "$progname: option $1: $2" >&2
|
||||||
|
usage >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
dry_run='0'
|
||||||
|
|
||||||
|
while getopts "hd" flags; do
|
||||||
|
case $flags in
|
||||||
|
h)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
d)
|
||||||
|
dry_run='1'
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
bad_option "$flags" 'invalid option'
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# values for the GEORGE webring
|
||||||
|
george() {
|
||||||
|
echo GEORGE
|
||||||
|
curl -s 'https://george.gh0.pw/embed.cgi?seirdy' | htmlq -a href 'main p a'
|
||||||
|
}
|
||||||
|
|
||||||
|
values_to_csv() {
|
||||||
|
tr '\n' ',' && echo
|
||||||
|
}
|
||||||
|
|
||||||
|
print_csv_values() {
|
||||||
|
printf %s "$(george)" | values_to_csv
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -f "$webrings_dest" ]; then
|
||||||
|
echo "webrings file already generated"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$dry_run" = '1' ]; then
|
||||||
|
print_csv_values
|
||||||
|
else
|
||||||
|
print_csv_values | cat "$webrings_src" - >"$webrings_dest"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# vi:ft=sh
|
|
@ -29,6 +29,7 @@ sed 7d "$html_file" | xmllint --format --encode UTF-8 --noent - | sd '^\t' '' >"
|
||||||
{
|
{
|
||||||
head -n7 "$tmp_file"
|
head -n7 "$tmp_file"
|
||||||
cat tmp.css
|
cat tmp.css
|
||||||
|
# shellcheck disable=SC2016 # these are regex statements, not shell expressions
|
||||||
tail -n +8 "$tmp_file" \
|
tail -n +8 "$tmp_file" \
|
||||||
| sd '<pre(?: tabindex="0")?>\n\t*<code ' '<pre tabindex="0"><code ' \
|
| sd '<pre(?: tabindex="0")?>\n\t*<code ' '<pre tabindex="0"><code ' \
|
||||||
| sd '(?:\n)?</code>\n(?:[\t\s]*)?</pre>' '</code></pre>' \
|
| sd '(?:\n)?</code>\n(?:[\t\s]*)?</pre>' '</code></pre>' \
|
||||||
|
|
Loading…
Reference in a new issue