mkdocs-semiliterate/tests/sites.bash
Glen Whitney bceddb0701 fix: Interpret custom_dir relative to current directory, not config directory
The custom theme dir handling was not working in case the mkdocs config
  file was not in the top-level directory. Since mkdocs itself seems only
  to work in the top-level directory, this PR modifies mkdocs_semiliterate
  to interpret custom theme dirs relative to the current directory.

  Also, improves the harmonization between current mkdocs_simple_plugin
  code and this code.

  Resolves #28.
2024-11-02 12:23:34 -07:00

24 lines
757 B
Bash

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."