mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-03-04 16:39:37 +00:00
Merge pull request #254 from revarbat/revarbat_dev
Index and Cheat Sheet generation script improvements.
This commit is contained in:
commit
7c2ef46e0b
3 changed files with 41 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
BOSL_VERSION = [2,0,415];
|
||||
BOSL_VERSION = [2,0,417];
|
||||
|
||||
|
||||
// Section: BOSL Library Version Functions
|
||||
|
|
Loading…
Reference in a new issue