aboutsummaryrefslogtreecommitdiff
path: root/spelling/check-spelling.sh
diff options
context:
space:
mode:
Diffstat (limited to 'spelling/check-spelling.sh')
-rwxr-xr-xspelling/check-spelling.sh37
1 files changed, 0 insertions, 37 deletions
diff --git a/spelling/check-spelling.sh b/spelling/check-spelling.sh
deleted file mode 100755
index 3ddfd2a..0000000
--- a/spelling/check-spelling.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env bash
-set -Eeuo pipefail
-
-HTML_DIR="${1:-}"
-[[ -z "${HTML_DIR}" ]] && {
- echo 'Undefined input HTML_DIR.' >&2
- exit 2
-}
-
-# Required by =sort= and =hunspell=
-export LANG=C.UTF-8
-
-for DICT in spelling/*.txt; do
- diff <(sort "$DICT" | uniq) "$DICT" || {
- echo "The $DICT dictionary is unsorted. To fix it, run:" >&2
- echo " LANG=C.UTF-8 sort $DICT | uniq | sponge $DICT" >&2
- exit 1
- }
-done
-
-rm -f spelling.txt
-shopt -s globstar
-for f in "${HTML_DIR}"/**/*.html; do
- if ! grep -E '/pastebin(/|s.html)' <(echo "$f") > /dev/null; then
- l="$(head -n2 "$f" | tail -n1 | cut -d\" -f2)"
- hunspell -u3 -H -d "$l" -p <(cat spelling/international.txt "spelling/$l.txt") "$f" | tee -a spelling.txt
- fi
-done
-
-if [[ -s spelling.txt ]]; then
- printf "\nvvv Mispelled words detected by hunspell.\n\n" >&2
- sort < spelling.txt | uniq >&2
- printf "\n^^^\n" >&2
- exit 1
-else
- echo "No words mispelled" >&2
-fi