From 226ee52f85bbfad36cd3b71d550942928cfda487 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Thu, 23 Nov 2023 19:06:46 -0800 Subject: [PATCH] Format shell scripts --- scripts/bin/axe-ff | 2 ++ scripts/bin/validate-feed | 1 - scripts/populate-webrings.sh | 7 +++---- scripts/xhtmlize-single-file.sh | 18 +++++++++--------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/bin/axe-ff b/scripts/bin/axe-ff index 67885f5..a51e53b 100755 --- a/scripts/bin/axe-ff +++ b/scripts/bin/axe-ff @@ -1,4 +1,6 @@ #!/bin/sh + +set -e -u # Runs axe on every page of my sitemap # first arg is output directory, after that comes urls from a sitemap. We replace the urls with equivalent local file paths. PATH="$(dirname "$0"):$PATH" diff --git a/scripts/bin/validate-feed b/scripts/bin/validate-feed index 28dedaf..fd7a7c5 100755 --- a/scripts/bin/validate-feed +++ b/scripts/bin/validate-feed @@ -39,7 +39,6 @@ done url="$1" - find_rel_mention_count() { curl -s "$url" | grep -cF 'rel="mentioned"' } diff --git a/scripts/populate-webrings.sh b/scripts/populate-webrings.sh index 260b0f8..f754a7e 100755 --- a/scripts/populate-webrings.sh +++ b/scripts/populate-webrings.sh @@ -8,7 +8,6 @@ set -e -u - # the name of this program progname="$(basename "$0")" dirname="$(dirname "$0")" @@ -58,15 +57,15 @@ done endless_orbit() { printf 'Endless Orbit,' curl -sSL --compressed https://linkyblog.neocities.org/onionring/onionring-variables.js \ - | grep -C 1 https://seirdy.one/ \ - | tr -d "'\n" | sed 's|https://seirdy.one/|https://linkyblog.neocities.org/webring.html|' + | grep -C 1 https://seirdy.one/ \ + | tr -d "'\n" | sed 's|https://seirdy.one/|https://linkyblog.neocities.org/webring.html|' echo 'null' } if [ "$dry_run" = '1' ]; then endless_orbit elif [ -f "$webrings_dest" ]; then - echo "webrings file already generated" + echo "webrings file already generated" else endless_orbit | cat "$webrings_src" - >"$webrings_dest" fi diff --git a/scripts/xhtmlize-single-file.sh b/scripts/xhtmlize-single-file.sh index 8b04b67..325b489 100644 --- a/scripts/xhtmlize-single-file.sh +++ b/scripts/xhtmlize-single-file.sh @@ -23,7 +23,7 @@ cleanup() { } trap cleanup EXIT -run_tidy () { +run_tidy() { tidy -asxhtml -config linter-configs/tidy.conf 2>/dev/null || true } @@ -36,13 +36,13 @@ sed 7d "$html_file" | xmllint --format --encode UTF-8 --noent - | tail -n +2 >"$ # shellcheck disable=SC2016 # these are regex statements, not shell expressions #shellcheck source=/home/rkumar/Executables/ghq/git.sr.ht/~seirdy/seirdy.one/scripts/xhtmlize.sh sed \ - -e '1,7d' \ - -e 's|( )?.span itemprop="familyName|  <|' \ - -E \ - -e 's|([a-z])(]*rel="(nofollow ugc|ugc nofollow)"([^>]*)?>liked)# \1#' \ - -e 's#^[\t\s]*<(code|/pre)#<\1#' \ - "$tmp_file" \ + -e '1,7d' \ + -e 's|( )?.span itemprop="familyName|  <|' \ + -E \ + -e 's|([a-z])(]*rel="(nofollow ugc|ugc nofollow)"([^>]*)?>liked)# \1#' \ + -e 's#^[\t\s]*<(code|/pre)#<\1#' \ + "$tmp_file" \ | awk '/^<\/code>/{printf "%s",$0;next}7' } >"$html_file"