mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-10 00:12:09 +00:00
Format shell scripts
This commit is contained in:
parent
d88d98f829
commit
226ee52f85
4 changed files with 14 additions and 14 deletions
|
@ -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"
|
||||||
|
|
|
@ -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"'
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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>( )?.span itemprop="familyName|</span> <span itemprop="familyName"|' \
|
-e 's|</span>( )?.span itemprop="familyName|</span> <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"
|
||||||
|
|
Loading…
Reference in a new issue