root/documentation/trunk/tutorials/generate-html.bat @ 27035

Revision 27035, 2.9 KB (checked in by ak19, 7 years ago)

1. Bringing Windows script generate-html.bat up to speed with changes to Linux script generate-html.sh that were made in revision 25767. 2. Tested on Windows: important changes to both scripts as well as Dictionary.java to get the tutorials generated when using a GS3 installation (when a gs3-setup file is sourced).

  • Property svn:keywords set to Author Date Id Revision
Line 
1@echo off
2
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
5if not "%GSDLHOME%" == "" goto generate
6
7echo You must run 'setup' in the top level folder of your Greenstone installation before running this script
8echo Usage: $0 [gs-major-version-number=2]
9goto exit
10
11:generate:
12setlocal
13set top_dir=%CD%
14set source_dir=%CD%\xml-source
15set processing_dir=%CD%\processing
16set output_dir=%CD%\html
17set tmp_dir=%CD%\tmp
18if not exist "%output_dir%" mkdir %output_dir%
19if not exist "%tmp_dir%" mkdir %tmp_dir%
20cd ..
21cd shared
22set shared_dir=%CD%
23cd %output_dir%
24
25
26set GSDL_OR_GSDL3SRC_HOME=%GSDLHOME%
27:: this environment variable varies for GS3, where GLI is located in GSDL3SRCHOME (GS3) and not in GSDLHOME (gs2build)
28if not "%GSDL3SRCHOME%" == "" if exist "%GSDL3SRCHOME%" (   
29    set GSDL_OR_GSDL3SRC_HOME=%GSDL3SRCHOME%
30)
31
32set CLASSPATH=%shared_dir%;%GSDLHOME%\gli;%GSDL_OR_GSDL3SRC_HOME%\gli\classes;%GSDLHOME%\perllib;%shared_dir%\xalan.jar
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.
37echo "processing top level index"
38java -cp "%CLASSPATH%" -DGSDLHOME="%GSDLHOME%" -DGSDL3SRCHOME="%GSDL3SRCHOME%" ApplyXSLT "en" "%processing_dir%\preprocess-tut-xml.xsl"  "%source_dir%\tutorial_en.xml" %* > "%tmp_dir%\tutorial_en.xml"
39java -cp "%CLASSPATH%" -DGSDLHOME="%GSDLHOME%" -DGSDL3SRCHOME="%GSDL3SRCHOME%" ApplyXSLT "en" "%processing_dir%\xml-to-top-index.xsl"  "%tmp_dir%\tutorial_en.xml" %* > "%output_dir%\index.html"
40
41echo "generating wiki index page"
42java -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"
43
44
45for %%G IN (en,fr,ru,es) do (
46if not exist "%output_dir%\%%G" mkdir "%output_dir%\%%G"
47
48echo "processing %%G version"
49cd %output_dir%\%%G
50
51if 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
53java -cp "%CLASSPATH%" -DGSDLHOME="%GSDLHOME%" -DGSDL3SRCHOME="%GSDL3SRCHOME%" ApplyXSLT %%G "%processing_dir%\xml-to-index.xsl" "%tmp_dir%\tutorial_%%G.xml" %* > "index.html"
54java -cp "%CLASSPATH%" -DGSDLHOME="%GSDLHOME%" -DGSDL3SRCHOME="%GSDL3SRCHOME%" ApplyXSLT %%G "%processing_dir%\xml-to-one-html.xsl" "%tmp_dir%\tutorial_%%G.xml" %* > "all_tutorials.html"
55java -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"
56cd ..
57)
58
59endlocal
60
61:exit:
62
63
Note: See TracBrowser for help on using the browser.