Ignore:
Timestamp:
2012-04-24T20:30:19+12:00 (12 years ago)
Author:
ak19
Message:
  1. ApplyXSLT takes an additional parameter: the Greenstone major version number, or sets this to 2 if none is provided. This is then passed onto the XSLT files. 2. generate-html.sh/bat will pass any commandline parameters on to ApplyXSLT.java. 3. Simplified the generate-html.bat file with a for loop to avoid code duplication. 4. The MajorVersion element will now be processed by processing/common.xsl: anything in a MajorVersion element whose number matches the Greenstone major version number specified to generate-html.sh/bat (or ApplyXSLT.java) will be output to html, if the MajorVersion number does not match, it won't be output.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentation/trunk/tutorials/generate-html.sh

    r24145 r25472  
    11#!/bin/bash
    22
     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
    35if [ "$GSDLHOME" == "" ]; then
    46    echo "You must run 'source setup.bash' in the top level folder of your Greenstone installation before running this script"
     7    echo "Usage: $0 [gs-major-version-number=2]"
    58    exit
    69fi
     10
     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
    715
    816top_dir=`pwd`
     
    1422export CLASSPATH=$shared_dir:$GSDLHOME/gli:$GSDLHOME/gli/classes:$GSDLHOME/perllib:$shared_dir/xalan.jar
    1523
    16 mkdir $output_dir
     24if [ ! -d $output_dir ]; then
     25    mkdir $output_dir
     26fi
    1727
    1828langs="en fr es ru"
    1929
     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
    2033echo "processing top level index"
    21 java -DGSDLHOME=$GSDLHOME ApplyXSLT en $processing_dir/xml-to-top-index.xsl  $source_dir/tutorial_en.xml > $output_dir/index.html
     34java -DGSDLHOME=$GSDLHOME ApplyXSLT "en" $processing_dir/xml-to-top-index.xsl  $source_dir/tutorial_en.xml "$@" > $output_dir/index.html
    2235
    2336echo "generating wiki index page"
    24 java -DGSDLHOME=$GSDLHOME ApplyXSLT en $processing_dir/xml-to-wiki-index.xsl $source_dir/tutorial_en.xml > $output_dir/wiki-index.txt
     37java -DGSDLHOME=$GSDLHOME ApplyXSLT "en" $processing_dir/xml-to-wiki-index.xsl $source_dir/tutorial_en.xml "$@" > $output_dir/wiki-index.txt
    2538
    2639for l in $langs; do
    2740    echo "Processing $l version"
    28     mkdir $output_dir/$l
     41    if [ ! -d $output_dir/$l ]; then
     42    mkdir $output_dir/$l
     43    fi
    2944    cd $output_dir/$l
    30     java -DGSDLHOME=$GSDLHOME ApplyXSLT $l $processing_dir/xml-to-index.xsl $source_dir/tutorial_$l.xml > index.html
    31     java -DGSDLHOME=$GSDLHOME ApplyXSLT $l $processing_dir/xml-to-one-html.xsl $source_dir/tutorial_$l.xml > all_tutorials.html
    32     java -DGSDLHOME=$GSDLHOME ApplyXSLT $l $processing_dir/xml-to-many-html.xsl $source_dir/tutorial_$l.xml | perl -S $GSDLHOME/gli/help/splithelpdocument.pl
     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
    3348    cd $top_dir
    3449done
Note: See TracChangeset for help on using the changeset viewer.