[18754] | 1 | #!/bin/bash
|
---|
[13636] | 2 |
|
---|
[25472] | 3 | # Usage: ./generate-html.sh [<gs-major-version-number]
|
---|
| 4 | # The optional parameter major version number, which can be 2 or 3, will be assumed to be (Greenstone) "2" if none is provided
|
---|
[13636] | 5 | if [ "$GSDLHOME" == "" ]; then
|
---|
[18754] | 6 | echo "You must run 'source setup.bash' in the top level folder of your Greenstone installation before running this script"
|
---|
[25472] | 7 | echo "Usage: $0 [gs-major-version-number=2]"
|
---|
[13636] | 8 | exit
|
---|
| 9 | fi
|
---|
| 10 |
|
---|
[25472] | 11 | #ApplyXSLT.java will take care of setting the default of the major Greenstone version if none is provided
|
---|
| 12 | #if [ "$1" != "" ]; then
|
---|
| 13 | # $major_version="2"
|
---|
| 14 | #fi
|
---|
| 15 |
|
---|
[13708] | 16 | top_dir=`pwd`
|
---|
| 17 | shared_dir=`pwd`/../shared
|
---|
| 18 | source_dir=`pwd`/xml-source
|
---|
| 19 | processing_dir=`pwd`/processing
|
---|
| 20 | output_dir=`pwd`/html
|
---|
[13636] | 21 |
|
---|
[18754] | 22 | export CLASSPATH=$shared_dir:$GSDLHOME/gli:$GSDLHOME/gli/classes:$GSDLHOME/perllib:$shared_dir/xalan.jar
|
---|
| 23 |
|
---|
[25472] | 24 | if [ ! -d $output_dir ]; then
|
---|
| 25 | mkdir $output_dir
|
---|
| 26 | fi
|
---|
[13708] | 27 |
|
---|
| 28 | langs="en fr es ru"
|
---|
| 29 |
|
---|
[25472] | 30 | # http://tadek.pietraszek.org/blog/2006/01/05/messing-up-with-command-line-arguments-in-bash/
|
---|
| 31 | # is on the difference between $@ and $* and when to add quotes around them
|
---|
| 32 |
|
---|
[13636] | 33 | echo "processing top level index"
|
---|
[25472] | 34 | java -DGSDLHOME=$GSDLHOME ApplyXSLT "en" $processing_dir/xml-to-top-index.xsl $source_dir/tutorial_en.xml "$@" > $output_dir/index.html
|
---|
[13636] | 35 |
|
---|
| 36 | echo "generating wiki index page"
|
---|
[25472] | 37 | java -DGSDLHOME=$GSDLHOME ApplyXSLT "en" $processing_dir/xml-to-wiki-index.xsl $source_dir/tutorial_en.xml "$@" > $output_dir/wiki-index.txt
|
---|
[13636] | 38 |
|
---|
[13708] | 39 | for l in $langs; do
|
---|
| 40 | echo "Processing $l version"
|
---|
[25472] | 41 | if [ ! -d $output_dir/$l ]; then
|
---|
| 42 | mkdir $output_dir/$l
|
---|
| 43 | fi
|
---|
[13708] | 44 | cd $output_dir/$l
|
---|
[25472] | 45 | java -DGSDLHOME=$GSDLHOME ApplyXSLT $l $processing_dir/xml-to-index.xsl $source_dir/tutorial_$l.xml "$@" > index.html
|
---|
| 46 | java -DGSDLHOME=$GSDLHOME ApplyXSLT $l $processing_dir/xml-to-one-html.xsl $source_dir/tutorial_$l.xml "$@" > all_tutorials.html
|
---|
| 47 | java -DGSDLHOME=$GSDLHOME ApplyXSLT $l $processing_dir/xml-to-many-html.xsl $source_dir/tutorial_$l.xml "$@" | perl -S $GSDLHOME/gli/help/splithelpdocument.pl
|
---|
[13708] | 48 | cd $top_dir
|
---|
| 49 | done
|
---|
[13636] | 50 |
|
---|
| 51 |
|
---|
| 52 |
|
---|