diff options
Diffstat (limited to '')
-rwxr-xr-x | spelling/check-spelling.sh | 29 | ||||
-rw-r--r-- | spelling/international.dic.txt | 2 | ||||
-rw-r--r-- | spelling/pt_BR.dic.txt | 2 |
3 files changed, 19 insertions, 14 deletions
diff --git a/spelling/check-spelling.sh b/spelling/check-spelling.sh index c9f03d2..653a5f9 100755 --- a/spelling/check-spelling.sh +++ b/spelling/check-spelling.sh @@ -3,7 +3,7 @@ set -Eeuo pipefail HTML_DIR="${1:-}" [[ -z "${HTML_DIR}" ]] && { - echo 'Undefined input HTML_DIR.' + echo 'Undefined input HTML_DIR.' >&2 exit 2 } @@ -12,26 +12,27 @@ export LANG=C.UTF-8 for DICT in spelling/*.txt; do diff <(sort "$DICT") "$DICT" || { - echo "The $DICT dictionary is unsorted. To fix it, run:" - echo " LANG=C.UTF-8 sort $DICT | sponge $DICT" + echo "The $DICT dictionary is unsorted. To fix it, run:" >&2 + echo " LANG=C.UTF-8 sort $DICT | sponge $DICT" >&2 exit 1 } done -cat spelling/*.txt > dicts.txt -check() { - html="$1" - echo "$1" - hunspell -l -p dicts.txt -d fr_FR -d en_US -i utf-8 "$html" | tee -a spelling.txt +finish() { + rm -f spelling.txt + rm -f dicts.txt } -export -f check -find "${HTML_DIR}" -type f -name '*.html' | grep -v pastebin | xargs -I{} bash -c "check {}" \; +trap finish EXIT + +cat spelling/*.txt > dicts.txt + +find "${HTML_DIR}" -type f -name '*.html' | grep -v pastebin | hunspell -l -p dicts.txt -d fr_FR -d en_US -i utf-8 >> spelling.txt if [[ -s spelling.txt ]]; then - printf "\nvvv Mispelled words detected by hunspell.\n\n" - sort < spelling.txt | uniq - printf "\n^^^\n" + 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" + echo "No words mispelled" >&2 fi diff --git a/spelling/international.dic.txt b/spelling/international.dic.txt index c3c3470..f3637be 100644 --- a/spelling/international.dic.txt +++ b/spelling/international.dic.txt @@ -34,6 +34,7 @@ buildGoModule ci dl guix +html i5 i7 intbytes @@ -41,6 +42,7 @@ js libre merkle myrepos +nixos no-brainer npm touchpad diff --git a/spelling/pt_BR.dic.txt b/spelling/pt_BR.dic.txt new file mode 100644 index 0000000..7ed8a57 --- /dev/null +++ b/spelling/pt_BR.dic.txt @@ -0,0 +1,2 @@ +os +sobre |