[2] | 1 | /*
|
---|
| 2 | *************************************************************************************
|
---|
| 3 | *
|
---|
| 4 | * DocBook Framework for OS/2 and eComStation
|
---|
| 5 | * Convert DocBook to HTML Help
|
---|
| 6 | *
|
---|
| 7 | * More info on the web:
|
---|
| 8 | * http://www.kacer.biz/os2/docbook-framework/
|
---|
| 9 | *
|
---|
| 10 | * Author:
|
---|
| 11 | * Jarda Kacer <mailto:jarda@kacer.biz>
|
---|
| 12 | *
|
---|
| 13 | *************************************************************************************
|
---|
| 14 | *
|
---|
| 15 | * This script converts a DocBook document into a set of HTML files,
|
---|
| 16 | * a HHP descriptor and a HHC table of contents.
|
---|
| 17 | * The files must be further processed on MS-Windows using the HTML Help Workshop
|
---|
| 18 | * application (HHC.EXE) in order to get the required final CHM file.
|
---|
| 19 | *
|
---|
| 20 | * If HHP generation fails because of non-ASCII characters, try to modify the following
|
---|
| 21 | * output parameters:
|
---|
| 22 | * <xsl:param name="htmlhelp.encoding" select="'windows-1250'"/>
|
---|
| 23 | * <xsl:param name="chunker.output.encoding" select="'windows-1250'"/>
|
---|
| 24 | * <xsl:param name="saxon.character.representation" select="'native'"/>
|
---|
| 25 | *
|
---|
| 26 | *************************************************************************************
|
---|
| 27 | *
|
---|
| 28 | * $Author: jkacer $
|
---|
| 29 | * $Revision: 2 $
|
---|
| 30 | * $Date: 2007-09-05 20:07:46 +0000 (Wed, 05 Sep 2007) $
|
---|
| 31 | * $HeadURL: trunk/Distribution/Scripts/DB2HTMLHelp.CMD $
|
---|
| 32 | *
|
---|
| 33 | *************************************************************************************
|
---|
| 34 | */
|
---|
| 35 |
|
---|
| 36 | OuterEnv = SetLocal()
|
---|
| 37 |
|
---|
| 38 | CALL RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
|
---|
| 39 | CALL SysLoadFuncs
|
---|
| 40 |
|
---|
| 41 | ScriptDir = GetScriptPath()
|
---|
| 42 | RootDir = GetParentDirectory(ScriptDir)
|
---|
| 43 |
|
---|
| 44 | Arguments = ARG(1)
|
---|
| 45 |
|
---|
| 46 | IF WORDS(Arguments) = 1
|
---|
| 47 | THEN DO
|
---|
| 48 | InputFile = WORD(Arguments, 1)
|
---|
| 49 | CALL Saxon InputFile || " " || RootDir || "\XSL\htmlhelp\htmlhelp.xsl use.extensions=1"
|
---|
| 50 | END
|
---|
| 51 | ELSE DO
|
---|
| 52 | CALL PrintUsage
|
---|
| 53 | END
|
---|
| 54 |
|
---|
| 55 | CALL EndLocal
|
---|
| 56 | EXIT
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 | /***********************************************************************************************/
|
---|
| 60 | /* Procedures and functions */
|
---|
| 61 | /***********************************************************************************************/
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 | /*
|
---|
| 65 | * Sets an environment variable or appends a value to it.
|
---|
| 66 | */
|
---|
| 67 | AddEnvironment: PROCEDURE
|
---|
| 68 | PARSE ARG VarName, VarValue
|
---|
| 69 | IF (Value(VarName, , "OS2ENVIRONMENT")="")
|
---|
| 70 | THEN CALL SetEnvironment VarName, VarValue
|
---|
| 71 | ELSE CALL Value VarName, GetEnvironment(VarName) || ";" || VarValue, "OS2ENVIRONMENT"
|
---|
| 72 | RETURN
|
---|
| 73 |
|
---|
| 74 |
|
---|
| 75 | /*
|
---|
| 76 | * Sets an environment variable, overwriting its previous value.
|
---|
| 77 | */
|
---|
| 78 | SetEnvironment: PROCEDURE
|
---|
| 79 | PARSE ARG VarName, VarValue
|
---|
| 80 | CALL Value VarName, VarValue, "OS2ENVIRONMENT"
|
---|
| 81 | RETURN
|
---|
| 82 |
|
---|
| 83 |
|
---|
| 84 | /*
|
---|
| 85 | * Returns the value of an environment variable.
|
---|
| 86 | */
|
---|
| 87 | GetEnvironment: PROCEDURE
|
---|
| 88 | PARSE ARG VarName
|
---|
| 89 | RETURN Value(VarName, , "OS2ENVIRONMENT")
|
---|
| 90 |
|
---|
| 91 |
|
---|
| 92 | /*
|
---|
| 93 | * Returns the current script name.
|
---|
| 94 | */
|
---|
| 95 | GetScriptName: PROCEDURE
|
---|
| 96 | PARSE SOURCE Result
|
---|
| 97 | RETURN WORD(Result, 3)
|
---|
| 98 |
|
---|
| 99 |
|
---|
| 100 | /*
|
---|
| 101 | * Returns the current script path, without "\" at the end.
|
---|
| 102 | */
|
---|
| 103 | GetScriptPath: PROCEDURE
|
---|
| 104 | ScriptName = GetScriptName()
|
---|
| 105 | RETURN SUBSTR(ScriptName, 1, LASTPOS("\", ScriptName)-1)
|
---|
| 106 |
|
---|
| 107 |
|
---|
| 108 | /*
|
---|
| 109 | * Returns True if the given file exists.
|
---|
| 110 | */
|
---|
| 111 | FileExists: PROCEDURE
|
---|
| 112 | PARSE ARG FileName
|
---|
| 113 | CALL SysFileTree FileName, Result
|
---|
| 114 | RETURN Result.0 > 0
|
---|
| 115 |
|
---|
| 116 |
|
---|
| 117 | /*
|
---|
| 118 | * Returns the current directory, without "\" at the end.
|
---|
| 119 | */
|
---|
| 120 | GetCurrentDir: PROCEDURE
|
---|
| 121 | RETURN DIRECTORY()
|
---|
| 122 |
|
---|
| 123 |
|
---|
| 124 | /*
|
---|
| 125 | * Returns the parent directory of the directory passed as argument, without "\" at the end.
|
---|
| 126 | */
|
---|
| 127 | GetParentDirectory: PROCEDURE
|
---|
| 128 | PARSE ARG DirName
|
---|
| 129 | RETURN SUBSTR(DirName, 1, LASTPOS("\", DirName)-1)
|
---|
| 130 |
|
---|
| 131 |
|
---|
| 132 | /*
|
---|
| 133 | * Prints out a short help on how to call this script.
|
---|
| 134 | */
|
---|
| 135 | PrintUsage: PROCEDURE
|
---|
| 136 | SAY "DocBook Framework for OS/2, DocBook --> HTML Help"
|
---|
| 137 | SAY "Usage: DB2HTMLHelp <DocBook Source>"
|
---|
| 138 | RETURN
|
---|
| 139 |
|
---|