blob: fb86abe6a315184a43f642b9140779a259880f0f (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/env bash
set -Eeuo pipefail
HTML_DIR="${1:-}"
[[ -z "${HTML_DIR}" ]] && {
echo 'Undefined input HTML_DIR.'
exit 2
}
# Required by =sort= and =hunspell=
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"
exit 1
}
done
hunspell -l -p <(cat spelling/international.dic.txt spelling/en_US.dic.txt spelling/en_US.aff.txt) -d en_US -i utf-8 $(find "$HTML_DIR" -type f -name '*.html') | tee spelling.txt
cat spelling.txt
if [[ -s spelling.txt ]]; then
echo "Mispelled words detected by hunspell."
cat spelling.txt
exit 1
else
echo "No words mispelled"
fi
|