source: trunk/Distribution/Scripts/DB2HTMLHelp.CMD

Last change on this file was 2, checked in by jkacer, 18 years ago

Added all DocBook Framework stuff:

  • DocBook DTD
  • Transformation software FOP 0.20.5 and Saxon 6
  • XSL styles
  • Rexx scripts

Also added some WarpIN-related stuff for creation of WarpIN installation packages.
This state corresponds to version 1.0.0 from November 2005, just slightly modified to carry versioning information (Rexx scripts).

  • Property svn:keywords set to Author Revision Date HeadURL Id
File size: 3.6 KB
Line 
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
36OuterEnv = SetLocal()
37
38CALL RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
39CALL SysLoadFuncs
40
41ScriptDir = GetScriptPath()
42RootDir = GetParentDirectory(ScriptDir)
43
44Arguments = ARG(1)
45
46IF 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
55CALL EndLocal
56EXIT
57
58
59/***********************************************************************************************/
60/* Procedures and functions */
61/***********************************************************************************************/
62
63
64/*
65 * Sets an environment variable or appends a value to it.
66 */
67AddEnvironment: PROCEDURE
68PARSE ARG VarName, VarValue
69IF (Value(VarName, , "OS2ENVIRONMENT")="")
70 THEN CALL SetEnvironment VarName, VarValue
71 ELSE CALL Value VarName, GetEnvironment(VarName) || ";" || VarValue, "OS2ENVIRONMENT"
72RETURN
73
74
75/*
76 * Sets an environment variable, overwriting its previous value.
77 */
78SetEnvironment: PROCEDURE
79PARSE ARG VarName, VarValue
80CALL Value VarName, VarValue, "OS2ENVIRONMENT"
81RETURN
82
83
84/*
85 * Returns the value of an environment variable.
86 */
87GetEnvironment: PROCEDURE
88PARSE ARG VarName
89RETURN Value(VarName, , "OS2ENVIRONMENT")
90
91
92/*
93 * Returns the current script name.
94 */
95GetScriptName: PROCEDURE
96PARSE SOURCE Result
97RETURN WORD(Result, 3)
98
99
100/*
101 * Returns the current script path, without "\" at the end.
102 */
103GetScriptPath: PROCEDURE
104ScriptName = GetScriptName()
105RETURN SUBSTR(ScriptName, 1, LASTPOS("\", ScriptName)-1)
106
107
108/*
109 * Returns True if the given file exists.
110 */
111FileExists: PROCEDURE
112PARSE ARG FileName
113CALL SysFileTree FileName, Result
114RETURN Result.0 > 0
115
116
117/*
118 * Returns the current directory, without "\" at the end.
119 */
120GetCurrentDir: PROCEDURE
121RETURN DIRECTORY()
122
123
124/*
125 * Returns the parent directory of the directory passed as argument, without "\" at the end.
126 */
127GetParentDirectory: PROCEDURE
128PARSE ARG DirName
129RETURN SUBSTR(DirName, 1, LASTPOS("\", DirName)-1)
130
131
132/*
133 * Prints out a short help on how to call this script.
134 */
135PrintUsage: PROCEDURE
136SAY "DocBook Framework for OS/2, DocBook --> HTML Help"
137SAY "Usage: DB2HTMLHelp <DocBook Source>"
138RETURN
139
Note: See TracBrowser for help on using the repository browser.