bitdispenser.dev/tools/spellchecker.sh
polpetta b7e9d065a2
All checks were successful
continuous-integration/drone/push Build is passing
Add spellchecker (#5)
* Add entries into dictionary
* Add spellchecker
* Update CI
* Fix first article

Co-authored-by: Davide Polonio <poloniodavide@gmail.com>
Reviewed-on: #5
2021-05-19 21:47:51 +00:00

26 lines
646 B
Bash
Executable File

#!/bin/bash
set -e
reporoot="$(git rev-parse --show-toplevel)"
lang="${1}"
if [ -z "${2}" ]
then
texdir="/content/english"
else
texdir="${2}"
fi
echo "Checking files in ${reporoot}${texdir}"
for i in $(find "${reporoot}${texdir}" -type f -iname "*.md")
do
tmp="$(cat "${i}" | aspell -M -a --lang="${lang}" --encoding=utf-8 --add-extra-dicts="${reporoot}/tools/dictionary.$1.pws" 2>/dev/null | grep -v "*" | grep -v "@" | grep -v "+" | sed '/^\s*$/d')"
if [ "${tmp}" != "" ]
then
echo "******* List of errors detected for ${i} *******"
echo "${tmp}"
exit 1
else
echo "${i} OK"
fi
done