#!/bin/bash

#Markdown
for i in $(find pages/ _posts/ _drafts/ -iname \*.md | grep -vF '/listing/' )
do
	#Check if current document does not need to be checked
	if [ "$i" == "pages/listing.md" ]; then continue; fi

	#If document contains the <!-- no spellcheck --> comment, ignore it
	SKIP_CHECK=`grep -iF '<!-- no spellcheck -->' "$i"`
	if [ "$SKIP_CHECK" ]; then continue; fi

	#Run spellcheck on each .md document
	echo "$i"
	aspell check --mode=markdown --lang=en --home-dir=. --personal="jargon.txt" "$i"
done
