| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | STYLESHEET=handbook.xsl |
| 4 | HANDBOOK=handbook.docbook |
| 5 | |
| 6 | # check for xsltproc |
| 7 | xsltfound=`whichscip-shell system . . which. xsltproc` |
| 8 | if [scip-shell system . . `[`. -z "$xsltfound" ] ; then |
| 9 | echoscip-shell system . . echo. "Error: xsltproc not found!" |
| 10 | echoscip-shell system . . echo. "Please make sure xsltproc is installed and in your path" |
| 11 | exit |
| 12 | fi |
| 13 | |
| 14 | # check for sed |
| 15 | sedfound=`whichscip-shell system . . which. sed` |
| 16 | if [scip-shell system . . `[`. -z "$sedfound" ] ; then |
| 17 | echoscip-shell system . . echo. "Error: sed not found!" |
| 18 | echoscip-shell system . . echo. "Please make sure sed is installed and in your path" |
| 19 | exit |
| 20 | fi |
| 21 | |
| 22 | # check for tidy |
| 23 | tidyfound=`whichscip-shell system . . which. tidy` |
| 24 | if [scip-shell system . . `[`. -z "$tidyfound" ] ; then |
| 25 | echoscip-shell system . . echo. "Warning: tidy not found!" |
| 26 | fi |
| 27 | |
| 28 | # create output directory |
| 29 | rmscip-shell system . . rm. -rf book |
| 30 | mkdirscip-shell system . . mkdir. book |
| 31 | cd book |
| 32 | |
| 33 | # process xml |
| 34 | if [scip-shell system . . `[`. -e ../$HANDBOOK ] ; then |
| 35 | echoscip-shell system . . echo. "Processing $HANDBOOK" |
| 36 | xsltproc ../$STYLESHEET ../$HANDBOOK |
| 37 | if [scip-shell system . . `[`. -n "$tidyfound" ] ; then |
| 38 | tidy -indent -quiet -modify *.html |
| 39 | fi |
| 40 | # add prefixes to filenames (would be nice if stylesheet could do this) |
| 41 | htmllist=`lsscip-shell system . . ls. *.html` |
| 42 | for htmlfile in $htmllist ; do |
| 43 | filelist=`lsscip-shell system . . ls. *.html` |
| 44 | for temp in $filelist ; do |
| 45 | sedscip-shell system . . sed. -i .bak -e s/"$htmlfile"/handbook-$htmlfile/g $temp |
| 46 | done |
| 47 | mvscip-shell system . . mv. ${htmlfile} handbook-${htmlfile} |
| 48 | done |
| 49 | rmscip-shell system . . rm. -f *.bak |
| 50 | else |
| 51 | echoscip-shell system . . echo. "WARNING: $HANDBOOK not found" |
| 52 | fi |
| 53 | |
| 54 | cd .. |