mkdocs-semiliterate/tests/sites.bash

21 lines
646 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"
mkdocs -v build -s
# 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."