[13636] | 1 | @echo off
|
---|
| 2 |
|
---|
[25472] | 3 | :: Usage: generate-html.bat [<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 not "%GSDLHOME%" == "" goto generate
|
---|
| 6 |
|
---|
| 7 | echo You must run 'setup' in the top level folder of your Greenstone installation before running this script
|
---|
[25472] | 8 | echo Usage: $0 [gs-major-version-number=2]
|
---|
[13636] | 9 | goto exit
|
---|
| 10 |
|
---|
[27035] | 11 | :generate:
|
---|
[25472] | 12 | setlocal
|
---|
[13743] | 13 | set top_dir=%CD%
|
---|
| 14 | set source_dir=%CD%\xml-source
|
---|
| 15 | set processing_dir=%CD%\processing
|
---|
| 16 | set output_dir=%CD%\html
|
---|
[27035] | 17 | set tmp_dir=%CD%\tmp
|
---|
| 18 | if not exist "%output_dir%" mkdir %output_dir%
|
---|
| 19 | if not exist "%tmp_dir%" mkdir %tmp_dir%
|
---|
[13743] | 20 | cd ..
|
---|
| 21 | cd shared
|
---|
| 22 | set shared_dir=%CD%
|
---|
| 23 | cd %output_dir%
|
---|
| 24 |
|
---|
[25472] | 25 |
|
---|
[27035] | 26 | set GSDL_OR_GSDL3SRC_HOME=%GSDLHOME%
|
---|
| 27 | :: this environment variable varies for GS3, where GLI is located in GSDL3SRCHOME (GS3) and not in GSDLHOME (gs2build)
|
---|
| 28 | if not "%GSDL3SRCHOME%" == "" if exist "%GSDL3SRCHOME%" (
|
---|
| 29 | set GSDL_OR_GSDL3SRC_HOME=%GSDL3SRCHOME%
|
---|
| 30 | )
|
---|
[25472] | 31 |
|
---|
[27053] | 32 | set CLASSPATH=%shared_dir%;%GSDLHOME%\gli;%GSDL_OR_GSDL3SRC_HOME%\gli\classes;%GSDLHOME%\perllib;%shared_dir%\xalan.jar;%GSDL_OR_GSDL3SRC_HOME%\web\WEB-INF\classes
|
---|
[27035] | 33 |
|
---|
| 34 | :: preprocess-tut-xml.xsl removes all the non-matching MajorVersion tags first
|
---|
| 35 | :: This needs to be done in a separate pass, to ensure NumberedItems nested in
|
---|
| 36 | :: MajorVersion tags preserve their numbering.
|
---|
[13636] | 37 | echo "processing top level index"
|
---|
[27035] | 38 | java -cp "%CLASSPATH%" -DGSDLHOME="%GSDLHOME%" -DGSDL3SRCHOME="%GSDL3SRCHOME%" ApplyXSLT "en" "%processing_dir%\preprocess-tut-xml.xsl" "%source_dir%\tutorial_en.xml" %* > "%tmp_dir%\tutorial_en.xml"
|
---|
| 39 | java -cp "%CLASSPATH%" -DGSDLHOME="%GSDLHOME%" -DGSDL3SRCHOME="%GSDL3SRCHOME%" ApplyXSLT "en" "%processing_dir%\xml-to-top-index.xsl" "%tmp_dir%\tutorial_en.xml" %* > "%output_dir%\index.html"
|
---|
[13636] | 40 |
|
---|
| 41 | echo "generating wiki index page"
|
---|
[27035] | 42 | java -cp "%CLASSPATH%" -DGSDLHOME="%GSDLHOME%" -DGSDL3SRCHOME="%GSDL3SRCHOME%" ApplyXSLT "en" "%processing_dir%\xml-to-wiki-index.xsl" "%tmp_dir%\tutorial_en.xml" %* > "%output_dir%\wiki-index.txt"
|
---|
[13636] | 43 |
|
---|
| 44 |
|
---|
[25472] | 45 | for %%G IN (en,fr,ru,es) do (
|
---|
[27035] | 46 | if not exist "%output_dir%\%%G" mkdir "%output_dir%\%%G"
|
---|
[13636] | 47 |
|
---|
[27035] | 48 | echo "processing %%G version"
|
---|
[25472] | 49 | cd %output_dir%\%%G
|
---|
[27035] | 50 |
|
---|
| 51 | if not "%%G" == "en" java -cp "%CLASSPATH%" -DGSDLHOME="%GSDLHOME%" -DGSDL3SRCHOME="%GSDL3SRCHOME%" ApplyXSLT %%G "%processing_dir%\preprocess-tut-xml.xsl" "%source_dir%\tutorial_%%G.xml" %* > "%tmp_dir%\tutorial_%%G.xml"
|
---|
| 52 |
|
---|
| 53 | java -cp "%CLASSPATH%" -DGSDLHOME="%GSDLHOME%" -DGSDL3SRCHOME="%GSDL3SRCHOME%" ApplyXSLT %%G "%processing_dir%\xml-to-index.xsl" "%tmp_dir%\tutorial_%%G.xml" %* > "index.html"
|
---|
| 54 | java -cp "%CLASSPATH%" -DGSDLHOME="%GSDLHOME%" -DGSDL3SRCHOME="%GSDL3SRCHOME%" ApplyXSLT %%G "%processing_dir%\xml-to-one-html.xsl" "%tmp_dir%\tutorial_%%G.xml" %* > "all_tutorials.html"
|
---|
| 55 | java -cp "%CLASSPATH%" -DGSDLHOME="%GSDLHOME%" -DGSDL3SRCHOME="%GSDL3SRCHOME%" ApplyXSLT %%G "%processing_dir%\xml-to-many-html.xsl" "%tmp_dir%\tutorial_%%G.xml" %* | perl -S "%GSDL_OR_GSDL3SRC_HOME%\gli\help\splithelpdocument.pl"
|
---|
[13636] | 56 | cd ..
|
---|
[25472] | 57 | )
|
---|
[13636] | 58 |
|
---|
[25472] | 59 | endlocal
|
---|
[13636] | 60 |
|
---|
| 61 | :exit:
|
---|
| 62 |
|
---|
| 63 |
|
---|