/* ************************************************************************************* * * DocBook Framework for OS/2 and eComStation * Convert DocBook to Java Help * * More info on the web: * http://www.kacer.biz/os2/docbook-framework/ * * Author: * Jarda Kacer * ************************************************************************************* * * This script converts a DocBook document into a set of HTML files that should be * further processed using Java Help Indexer, packed into a JAR file and viewed * using Help Set Viewer or from within a Java application. * You will need to download Java Help from http://java.sun.com/products/javahelp * ************************************************************************************* * * $Author: jkacer $ * $Revision: 2 $ * $Date: 2007-09-05 20:07:46 +0000 (Wed, 05 Sep 2007) $ * $HeadURL: trunk/Distribution/Scripts/DB2JavaHelp.CMD $ * ************************************************************************************* */ OuterEnv = SetLocal() CALL RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs" CALL SysLoadFuncs ScriptDir = GetScriptPath() RootDir = GetParentDirectory(ScriptDir) Arguments = ARG(1) IF WORDS(Arguments) = 1 THEN DO InputFile = WORD(Arguments, 1) CALL Saxon InputFile || " " || RootDir || "\XSL\javahelp\javahelp.xsl use.extensions=1" END ELSE DO CALL PrintUsage END CALL EndLocal EXIT /***********************************************************************************************/ /* Procedures and functions */ /***********************************************************************************************/ /* * Sets an environment variable or appends a value to it. */ AddEnvironment: PROCEDURE PARSE ARG VarName, VarValue IF (Value(VarName, , "OS2ENVIRONMENT")="") THEN CALL SetEnvironment VarName, VarValue ELSE CALL Value VarName, GetEnvironment(VarName) || ";" || VarValue, "OS2ENVIRONMENT" RETURN /* * Sets an environment variable, overwriting its previous value. */ SetEnvironment: PROCEDURE PARSE ARG VarName, VarValue CALL Value VarName, VarValue, "OS2ENVIRONMENT" RETURN /* * Returns the value of an environment variable. */ GetEnvironment: PROCEDURE PARSE ARG VarName RETURN Value(VarName, , "OS2ENVIRONMENT") /* * Returns the current script name. */ GetScriptName: PROCEDURE PARSE SOURCE Result RETURN WORD(Result, 3) /* * Returns the current script path, without "\" at the end. */ GetScriptPath: PROCEDURE ScriptName = GetScriptName() RETURN SUBSTR(ScriptName, 1, LASTPOS("\", ScriptName)-1) /* * Returns True if the given file exists. */ FileExists: PROCEDURE PARSE ARG FileName CALL SysFileTree FileName, Result RETURN Result.0 > 0 /* * Returns the current directory, without "\" at the end. */ GetCurrentDir: PROCEDURE RETURN DIRECTORY() /* * Returns the parent directory of the directory passed as argument, without "\" at the end. */ GetParentDirectory: PROCEDURE PARSE ARG DirName RETURN SUBSTR(DirName, 1, LASTPOS("\", DirName)-1) /* * Prints out a short help on how to call this script. */ PrintUsage: PROCEDURE SAY "DocBook Framework for OS/2, DocBook --> Java Help" SAY "Usage: DB2JavaHelp " RETURN