1#!/bin/bash 2 3echo "Building docs..." 4mkdocs build --strict 5if [ $? -ne 0 ]; then 6 exit 1 7fi 8echo "Compiling Dictionary..." 9aspell --lang=en create master ./tmp <.spell-dict 10if [ $? -ne 0 ]; then 11 exit 1 12fi 13echo "Checking spelling..." 14 15let "fails=0" 16 17for file in $(find site/ -type f -name "*.html"); do 18 words=$(aspell list --lang=en --mode=html --add-html-skip=code --extra-dicts=./tmp <$file) 19 if [ "$words" ]; then 20 uniquewords=$(tr ' ' '\n' <<< "${words[@]}" | sort -u | tr '\n' ' ') 21 let "fails++" 22 echo "Misspelled words in '$file':" 23 echo "-----------------------------------------------------------------" 24 for word in ${uniquewords[@]}; do 25 echo $word 26 done 27 echo "-----------------------------------------------------------------" 28 fi 29done 30rm -f ./tmp 31rm -rf site 32 33if [ $fails -gt 0 ]; then 34 echo "$fails files with misspelled words." 35 exit 1 36else 37 exit 0 38fi 39