diff --git a/scripts/gencheat.sh b/scripts/gencheat.sh index 6762f0ac..da801c25 100755 --- a/scripts/gencheat.sh +++ b/scripts/gencheat.sh @@ -26,7 +26,7 @@ function columnize hdrln1="| $(ucase $1) " hdrln2='|:-----' n=1 - while [[ $n < $maxcols ]] ; do + while [[ $n -lt $maxcols ]] ; do hdrln1+=' |  ' hdrln2+=' |:------' n=$(($n+1)) @@ -34,7 +34,7 @@ function columnize hdrln1+=' |' hdrln2+=' |' n=0 - while [[ $n < $maxrows ]] ; do + while [[ $n -lt $maxrows ]] ; do lines[$n]="" n=$(($n+1)) done @@ -56,7 +56,7 @@ function columnize echo $hdrln1 echo $hdrln2 n=0 - while [[ $n < $maxrows ]] ; do + while [[ $n -lt $maxrows ]] ; do echo "| ${lines[$n]} |" n=$(($n+1)) done @@ -67,6 +67,11 @@ function mkconstindex sed 's/([^)]*)//g' | sed 's/[^a-zA-Z0-9_.:$]//g' | awk -F ':' '{printf "[%s](%s#%s)\n", $3, $1, $3}' } +function mkconstindex2 +{ + sed 's/ *=.*$//' | sed 's/[^a-zA-Z0-9_.:$]//g' | awk -F ':' '{printf "[%s](%s#%s)\n", $2, $1, $2}' +} + function mkotherindex { sed 's/([^)]*)//g' | sed 's/[^a-zA-Z0-9_.:$]//g' | awk -F ':' '{printf "[%s()](%s#%s)\n", $3, $1, $3}' @@ -80,9 +85,11 @@ CHEAT_FILES=$(grep '^include' std.scad | sed 's/^.*<\([a-zA-Z0-9.]*\)>/\1/'|grep echo '( [Alphabetic Index](Index) )' echo for f in $CHEAT_FILES ; do - #echo "### $f" ( - egrep -H 'Constant: ' $f | mkconstindex + ( + grep -H 'Constant: ' $f | mkconstindex + grep -H '^[A-Z$][A-Z0-9_]* *=.*//' $f | mkconstindex2 + ) | sort -u egrep -H 'Function: |Function&Module: |Module: ' $f | mkotherindex ) | columnize $f echo diff --git a/scripts/genindex.sh b/scripts/genindex.sh index 9d3e8cd0..51a90750 100755 --- a/scripts/genindex.sh +++ b/scripts/genindex.sh @@ -6,16 +6,18 @@ function ucase echo "$1" | tr '[:lower:]' '[:upper:]' } + function lcase { echo "$1" | tr '[:upper:]' '[:lower:]' } -function mkindex + +function alphaindex { - TMPFILE=$(mktemp -t $(basename $0).XXXXXX) || exit 1 - sed 's/([^)]*)//g' | sed 's/[^a-zA-Z0-9_.:$]//g' | awk -F ':' '{printf "- [%s](%s#%s)\n", $3, $1, $3}' | sort -d -f -u >> $TMPFILE alpha="A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" + TMPFILE=$(mktemp -t $(basename $0).XXXXXX) || exit 1 + sort -d -f >> $TMPFILE for a in $alpha; do echo -n "[$a](#$(lcase "$a")) " done @@ -33,13 +35,31 @@ function mkindex } +function constlist +{ + sed 's/([^)]*)//g' | sed 's/[^a-zA-Z0-9_.:$]//g' | awk -F ':' '{printf "- [%s](%s#%s) (in %s)\n", $3, $1, $3, $1}' +} + +function constlist2 +{ + sed 's/ *=.*$//' | sed 's/[^a-zA-Z0-9_.:$]//g' | awk -F ':' '{printf "- [%s](%s#%s) (in %s)\n", $2, $1, $2, $1}' +} + + +function funclist +{ + sed 's/([^)]*)//g' | sed 's/[^a-zA-Z0-9_.:$]//g' | awk -F ':' '{printf "- [%s()](%s#%s) (in %s)\n", $3, $1, $3, $1}' +} + + ( echo "## Belfry OpenScad Library Index" ( - grep 'Constant: ' *.scad - grep 'Function: ' *.scad - grep 'Function&Module: ' *.scad - grep 'Module: ' *.scad - ) | mkindex + ( + grep 'Constant: ' *.scad | constlist + grep '^[A-Z]* *=.*//' *.scad | constlist2 + ) | sort -u + egrep 'Function: |Function&Module: |Module: ' *.scad | sort -u | funclist + ) | sort | alphaindex ) > BOSL2.wiki/Index.md diff --git a/version.scad b/version.scad index bdbdafae..ffa8d27f 100644 --- a/version.scad +++ b/version.scad @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,415]; +BOSL_VERSION = [2,0,417]; // Section: BOSL Library Version Functions