2019-03-23 04:13:18 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-06-02 00:09:17 +00:00
|
|
|
FORCED=""
|
|
|
|
IMGGEN=""
|
|
|
|
FILES=""
|
2019-07-24 05:54:37 +00:00
|
|
|
DISPMD=""
|
2019-06-02 00:09:17 +00:00
|
|
|
for opt in "$@" ; do
|
|
|
|
case $opt in
|
|
|
|
-f ) FORCED=$opt ;;
|
|
|
|
-i ) IMGGEN=$opt ;;
|
2019-07-24 05:54:37 +00:00
|
|
|
-d ) DISPMD=$opt ;;
|
2019-07-30 19:50:56 +00:00
|
|
|
-* ) echo "Unknown option $opt"; exit -1 ;;
|
2019-06-02 00:09:17 +00:00
|
|
|
* ) FILES="$FILES $opt" ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ "$FILES" != "" ]]; then
|
|
|
|
PREVIEW_LIBS="$FILES"
|
2019-04-24 10:32:38 +00:00
|
|
|
else
|
2019-11-05 21:33:48 +00:00
|
|
|
PREVIEW_LIBS="version common errors attachments math arrays vectors affine coords geometry triangulation quaternions strings stacks queues structs vnf skin hull constants edges transforms primitives shapes masks shapes2d paths beziers rounding walls cubetruss metric_screws threading partitions involute_gears sliders joiners linear_bearings nema_steppers wiring phillips_drive torx_drive polyhedra knurling cubetruss debug"
|
2019-04-24 10:32:38 +00:00
|
|
|
fi
|
2019-03-23 04:13:18 +00:00
|
|
|
|
|
|
|
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."
|
2019-03-23 04:13:18 +00:00
|
|
|
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)"
|
2019-03-23 04:13:18 +00:00
|
|
|
mkdir -p images/$lib
|
2019-07-24 05:54:37 +00:00
|
|
|
if [ "$IMGGEN" != "" ]; then
|
2019-06-02 00:09:17 +00:00
|
|
|
rm -f images/$lib/*.png images/$lib/*.gif
|
|
|
|
fi
|
2019-05-14 02:28:52 +00:00
|
|
|
echo "$lib.scad"
|
2019-06-02 00:09:17 +00:00
|
|
|
../scripts/docs_gen.py ../$lib.scad -o $lib.scad.md -c $IMGGEN $FORCED -I images/$lib/ || exit 1
|
2019-07-24 05:54:37 +00:00
|
|
|
if [ "$DISPMD" != "" ]; then
|
|
|
|
open -a Typora $lib.scad.md
|
|
|
|
fi
|
2019-03-23 04:13:18 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
|