BOSL2/scripts/make_all_docs.sh

48 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/bash
FORCED=""
IMGGEN=""
2020-06-20 06:00:40 +00:00
TESTONLY=""
FILES=""
DISPMD=""
for opt in "$@" ; do
case $opt in
-f ) FORCED=$opt ;;
-i ) IMGGEN=$opt ;;
2020-06-20 06:00:40 +00:00
-t ) TESTONLY=$opt ;;
-d ) DISPMD=$opt ;;
-* ) echo "Unknown option $opt"; exit -1 ;;
* ) FILES="$FILES $opt" ;;
esac
done
if [[ "$FILES" != "" ]]; then
PREVIEW_LIBS="$FILES"
2019-04-24 10:32:38 +00:00
else
2020-12-13 01:11:19 +00:00
PREVIEW_LIBS=$(git ls-files | grep '\.scad$' | grep -v / | grep -v -f .nodocsfiles)
2019-04-24 10:32:38 +00:00
fi
dir="$(basename $PWD)"
2019-04-19 06:45:46 +00:00
if [ "$dir" = "BOSL2" ]; then
cd BOSL2.wiki
elif [ "$dir" != "BOSL2.wiki" ]; then
echo "Must run this script from the BOSL2 or BOSL2/BOSL2.wiki directories."
exit 1
fi
rm -f tmpscad*.scad
for lib in $PREVIEW_LIBS; do
2019-04-24 10:32:38 +00:00
lib="$(basename $lib .scad)"
mkdir -p images/$lib
2020-06-20 06:18:04 +00:00
if [ "$IMGGEN" != "" -a "$TESTONLY" != "" ]; then
rm -f images/$lib/*.png images/$lib/*.gif
fi
2019-05-14 02:28:52 +00:00
echo "$lib.scad"
2020-06-20 06:00:40 +00:00
../scripts/docs_gen.py ../$lib.scad -o $lib.scad.md -c $IMGGEN $FORCED $TESTONLY -I images/$lib/ || exit 1
if [ "$DISPMD" != "" ]; then
open -a Typora $lib.scad.md
fi
done