#!/bin/sh #generates HTML man pages docs/html/index.html # Markus Neteler, 2003, 2004 #exclude following list of modules from help index: # does not yet work for several modules: EXCLUDEHTML="v.topo.check" ############# nothing to configure below ############ write_html_header() { # $1: filename # $2: page title echo " $2

GRASS GIS 5.7 Reference Manual

This reference manual details the use of modules distributed with Geographic Resources Analysis Support System (GRASS), an open source (GNU GPL'ed), image processing and geographic information system (GIS).

" > $1 } write_html_footer() { # $1: filename # $2: help index url echo "


" >> $1 echo "Help Index | Full Index
" >> $1 echo "© 2003-2004 GRASS Development Team" >> $1 echo "" >> $1 echo "" >> $1 } expand_module_class_name() { # $1: module class if [ "$1" = "d" ] ; then echo "display" elif [ "$1" = "db" ] ; then echo "database" elif [ "$1" = "g" ] ; then echo "general" elif [ "$1" = "i" ] ; then echo "imagery" elif [ "$1" = "m" ] ; then echo "misc" elif [ "$1" = "pg" ] ; then echo "postGRASS" elif [ "$1" = "ps" ] ; then echo "postscript" elif [ "$1" = "r" ] ; then echo "raster" elif [ "$1" = "r3" ] ; then echo "raster3D" elif [ "$1" = "s" ] ; then echo "sites" elif [ "$1" = "v" ] ; then echo "vector" else echo "$1" fi } #are we in the tools/ dir? ls build_html_index.html 2> /dev/null if [ $? -eq 1 ] ; then echo "ERROR: this script must be run from the tools/ directory" exit fi #fetch the ARCH for store the files: ARCH="`cat ../include/Make/Platform.make | grep '^ARCH' | sed 's+ ++g' | cut -d'=' -f2`" HTMLDIR="../dist.$ARCH/docs/html" FULLINDEX=full_index.html #hardcoded list of notes etc: NOTESLIST="sql" #hardcoded list of drivers etc: DRIVERLIST="displaydrivers" #hardcoded list of variables etc: VARIABLES="variables" ################ cd $HTMLDIR #get list of available GRASS modules: CMDLIST=`ls -1 *.*.html | grep -v "$FULLINDEX" | grep -v index.html | grep -v '$EXCLUDEHTML' | cut -d'.' -f1 | sort -u` CMDLISTNO=`echo $CMDLIST | wc -w | awk '{print $1}'` #write main index: echo "Generating HTML manual pages..." write_html_header $FULLINDEX "GRASS GIS 5.7 Reference Manual" echo "Full command index:" >> $FULLINDEX #generate main index of all modules: echo "[ " >> $FULLINDEX k=0 for i in $CMDLIST do k=`expr $k + 1` echo -n "$i.*" >> $FULLINDEX if [ $k -lt $CMDLISTNO ] ; then echo -n " | " >> $FULLINDEX fi done echo " ]

" >> $FULLINDEX #for all module groups: for i in $CMDLIST do echo "" >> $FULLINDEX echo "$i.* commands:" >> $FULLINDEX echo "

" >> $FULLINDEX echo "

" >> $FULLINDEX done write_html_footer $FULLINDEX index.html # done full index #next write separate module pages: #for all module groups: for k in $CMDLIST do MODCLASS=`expand_module_class_name $k` FILENAME=$MODCLASS.html write_html_header $FILENAME "GRASS GIS 5.7 Reference Manual" echo "$MODCLASS commands:" >> $FILENAME echo "

" >> $FILENAME echo "

" >> $FILENAME write_html_footer $FILENAME index.html done #next write main page: FILENAME=index.html write_html_header $FILENAME "GRASS GIS 5.7 Reference Manual" #modules: echo "Manual sections:" >> $FILENAME echo "

" >> $FILENAME echo "

" >> $FILENAME #notes: echo "Notes sections:" >> $FILENAME echo "

" >> $FILENAME echo "

" >> $FILENAME ############# #drivers: echo "Drivers sections:" >> $FILENAME echo "

" >> $FILENAME echo "

" >> $FILENAME ############# #variables: echo "GRASS and environment variables:" >> $FILENAME echo "

" >> $FILENAME echo "

" >> $FILENAME ############# write_html_footer $FILENAME index.html ############# echo "Generated HTML docs in $HTMLDIR/index.html" echo "----------------------------------------------------------------------" echo "Following modules are missing the 'description.html' file in src code:" for i in `find . -name "*.*.html" | sort | grep -v "$FULLINDEX" | grep -v 'index.html'` do if grep 'DESCRIPTION' $i >/dev/null 2>&1 ; then : else echo `echo $i | sed 's?./??' | sed 's/.html//'` fi done echo "----------------------------------------------------------------------"