mkdocs-semiliterate/tests/sites.bash

24 lines
757 B
Bash
Raw Permalink Normal View History

set -e
shopt -s globstar
startdir=$PWD
for file in tests/fixtures/*
do
echo "Testing $startdir/$file"
cd "$startdir/$file"
if test -d "$startdir/$file/etc"; then
mkdocs -v build --config-file etc/mkdocs.yml -s
else mkdocs -v build -s
fi
# unfortunately MkDocs writes the run date in the last few lines of index
# and has version numbers in some of the scripts that are irrelevant:
for hml in **/*.html
do
grep -v MkDocs.version $hml | grep -v Build.Date.UTC | grep -v '[</]script[ >]' | grep -v '[</]link' > "$hml.cropped"
rm $hml
done
diff -r -x img -x '*fonts*' -x js -x '*.xml*' refsite site
echo "Site in $file built successfully"
rm -r site
done
echo "All site tests passed."