1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-09-19 20:02:10 +00:00

Format shell scripts

This commit is contained in:
Rohan Kumar 2023-11-23 19:06:46 -08:00
parent d88d98f829
commit 226ee52f85
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
4 changed files with 14 additions and 14 deletions

View file

@ -1,4 +1,6 @@
#!/bin/sh #!/bin/sh
set -e -u
# Runs axe on every page of my sitemap # 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. # 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" PATH="$(dirname "$0"):$PATH"

View file

@ -39,7 +39,6 @@ done
url="$1" url="$1"
find_rel_mention_count() { find_rel_mention_count() {
curl -s "$url" | grep -cF 'rel="mentioned"' curl -s "$url" | grep -cF 'rel="mentioned"'
} }

View file

@ -8,7 +8,6 @@
set -e -u set -e -u
# the name of this program # the name of this program
progname="$(basename "$0")" progname="$(basename "$0")"
dirname="$(dirname "$0")" dirname="$(dirname "$0")"
@ -58,15 +57,15 @@ done
endless_orbit() { endless_orbit() {
printf 'Endless Orbit,' printf 'Endless Orbit,'
curl -sSL --compressed https://linkyblog.neocities.org/onionring/onionring-variables.js \ curl -sSL --compressed https://linkyblog.neocities.org/onionring/onionring-variables.js \
| grep -C 1 https://seirdy.one/ \ | grep -C 1 https://seirdy.one/ \
| tr -d "'\n" | sed 's|https://seirdy.one/|https://linkyblog.neocities.org/webring.html|' | tr -d "'\n" | sed 's|https://seirdy.one/|https://linkyblog.neocities.org/webring.html|'
echo 'null' echo 'null'
} }
if [ "$dry_run" = '1' ]; then if [ "$dry_run" = '1' ]; then
endless_orbit endless_orbit
elif [ -f "$webrings_dest" ]; then elif [ -f "$webrings_dest" ]; then
echo "webrings file already generated" echo "webrings file already generated"
else else
endless_orbit | cat "$webrings_src" - >"$webrings_dest" endless_orbit | cat "$webrings_src" - >"$webrings_dest"
fi fi

View file

@ -23,7 +23,7 @@ cleanup() {
} }
trap cleanup EXIT trap cleanup EXIT
run_tidy () { run_tidy() {
tidy -asxhtml -config linter-configs/tidy.conf 2>/dev/null || true 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 disable=SC2016 # these are regex statements, not shell expressions
#shellcheck source=/home/rkumar/Executables/ghq/git.sr.ht/~seirdy/seirdy.one/scripts/xhtmlize.sh #shellcheck source=/home/rkumar/Executables/ghq/git.sr.ht/~seirdy/seirdy.one/scripts/xhtmlize.sh
sed \ sed \
-e '1,7d' \ -e '1,7d' \
-e 's|</span>(&nbsp;)?.span itemprop="familyName|</span>&#160;<span itemprop="familyName"|' \ -e 's|</span>(&nbsp;)?.span itemprop="familyName|</span>&#160;<span itemprop="familyName"|' \
-e 's|class="u-photo photo"[^<]*<|class="u-photo photo"/> <|' \ -e 's|class="u-photo photo"[^<]*<|class="u-photo photo"/> <|' \
-E \ -E \
-e 's|([a-z])<data|\1 <data|' \ -e 's|([a-z])<data|\1 <data|' \
-e 's#</span>(<a[^>]*rel="(nofollow ugc|ugc nofollow)"([^>]*)?>liked</a>)#</span> \1#' \ -e 's#</span>(<a[^>]*rel="(nofollow ugc|ugc nofollow)"([^>]*)?>liked</a>)#</span> \1#' \
-e 's#^[\t\s]*<(code|/pre)#<\1#' \ -e 's#^[\t\s]*<(code|/pre)#<\1#' \
"$tmp_file" \ "$tmp_file" \
| awk '/^<\/code>/{printf "%s",$0;next}7' | awk '/^<\/code>/{printf "%s",$0;next}7'
} >"$html_file" } >"$html_file"