source: documentation/trunk/tutorials/generate-html.bat@ 27035

Last change on this file since 27035 was 27035, checked in by ak19, 11 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
File size: 2.9 KB
RevLine 
[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]5if not "%GSDLHOME%" == "" goto generate
6
7echo You must run 'setup' in the top level folder of your Greenstone installation before running this script
[25472]8echo Usage: $0 [gs-major-version-number=2]
[13636]9goto exit
10
[27035]11:generate:
[25472]12setlocal
[13743]13set top_dir=%CD%
14set source_dir=%CD%\xml-source
15set processing_dir=%CD%\processing
16set output_dir=%CD%\html
[27035]17set tmp_dir=%CD%\tmp
18if not exist "%output_dir%" mkdir %output_dir%
19if not exist "%tmp_dir%" mkdir %tmp_dir%
[13743]20cd ..
21cd shared
22set shared_dir=%CD%
23cd %output_dir%
24
[25472]25
[27035]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)
[25472]31
[27035]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.
[13636]37echo "processing top level index"
[27035]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"
[13636]40
41echo "generating wiki index page"
[27035]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"
[13636]43
44
[25472]45for %%G IN (en,fr,ru,es) do (
[27035]46if not exist "%output_dir%\%%G" mkdir "%output_dir%\%%G"
[13636]47
[27035]48echo "processing %%G version"
[25472]49cd %output_dir%\%%G
[27035]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"
[13636]56cd ..
[25472]57)
[13636]58
[25472]59endlocal
[13636]60
61:exit:
62
63
Note: See TracBrowser for help on using the repository browser.