1#!/bin/bash
 2
 3if [[ $# > 0 ]]; then
 4    PREVIEW_LIBS="$@"
 5else
 6    PREVIEW_LIBS="constants compat transforms shapes masks paths beziers math metric_screws threading involute_gears sliders joiners linear_bearings nema_steppers wiring triangulation quaternions phillips_drive torx_drive debug"
 7fi
 8
 9dir="$(basename $PWD)"
10if [ "$dir" = "BOSL" ]; then
11    cd BOSL.wiki
12elif [ "$dir" != "BOSL.wiki" ]; then
13    echo "Must run this script from the BOSL or BOSL/BOSL.wiki directories."
14    exit 1
15fi
16
17rm -f tmpscad*.scad
18for lib in $PREVIEW_LIBS; do
19    lib="$(basename $lib .scad)"
20    mkdir -p images/$lib
21    rm -f images/$lib/*.png images/$lib/*.gif
22    echo ../scripts/docs_gen.py ../$lib.scad -o $lib.scad.md -c -i -I images/$lib/
23    ../scripts/docs_gen.py ../$lib.scad -o $lib.scad.md -c -i -I images/$lib/ || exit 1
24    open -a Typora $lib.scad.md
25done
26
27