source: trunk/Distribution/Scripts/DB2XHTMLChunks.CMD@ 3

Last change on this file since 3 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.0 KB
Line 
1/*
2 *************************************************************************************
3 *
4 * DocBook Framework for OS/2 and eComStation
5 * Convert DocBook to XHTML
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 XHTML files.
16 *
17 *************************************************************************************
18 *
19 * $Author: jkacer $
20 * $Revision: 2 $
21 * $Date: 2007-09-05 20:07:46 +0000 (Wed, 05 Sep 2007) $
22 * $HeadURL: trunk/Distribution/Scripts/DB2XHTMLChunks.CMD $
23 *
24 *************************************************************************************
25 */
26
27OuterEnv = SetLocal()
28
29CALL RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
30CALL SysLoadFuncs
31
32ScriptDir = GetScriptPath()
33RootDir = GetParentDirectory(ScriptDir)
34
35Arguments = ARG(1)
36
37IF WORDS(Arguments) = 1
38 THEN DO
39 CALL Saxon WORD(Arguments, 1) || " " || RootDir || "\XSL\xhtml\chunk.xsl use.extensions=1"
40 END
41 ELSE DO
42 CALL PrintUsage
43 END
44
45CALL EndLocal
46EXIT
47
48
49/***********************************************************************************************/
50/* Procedures and functions */
51/***********************************************************************************************/
52
53
54/*
55 * Sets an environment variable or appends a value to it.
56 */
57AddEnvironment: PROCEDURE
58PARSE ARG VarName, VarValue
59IF (Value(VarName, , "OS2ENVIRONMENT")="")
60 THEN CALL SetEnvironment VarName, VarValue
61 ELSE CALL Value VarName, GetEnvironment(VarName) || ";" || VarValue, "OS2ENVIRONMENT"
62RETURN
63
64
65/*
66 * Sets an environment variable, overwriting its previous value.
67 */
68SetEnvironment: PROCEDURE
69PARSE ARG VarName, VarValue
70CALL Value VarName, VarValue, "OS2ENVIRONMENT"
71RETURN
72
73
74/*
75 * Returns the value of an environment variable.
76 */
77GetEnvironment: PROCEDURE
78PARSE ARG VarName
79RETURN Value(VarName, , "OS2ENVIRONMENT")
80
81
82/*
83 * Returns the current script name.
84 */
85GetScriptName: PROCEDURE
86PARSE SOURCE Result
87RETURN WORD(Result, 3)
88
89
90/*
91 * Returns the current script path, without "\" at the end.
92 */
93GetScriptPath: PROCEDURE
94ScriptName = GetScriptName()
95RETURN SUBSTR(ScriptName, 1, LASTPOS("\", ScriptName)-1)
96
97
98/*
99 * Returns True if the given file exists.
100 */
101FileExists: PROCEDURE
102PARSE ARG FileName
103CALL SysFileTree FileName, Result
104RETURN Result.0 > 0
105
106
107/*
108 * Returns the current directory, without "\" at the end.
109 */
110GetCurrentDir: PROCEDURE
111RETURN DIRECTORY()
112
113
114/*
115 * Returns the parent directory of the directory passed as argument, without "\" at the end.
116 */
117GetParentDirectory: PROCEDURE
118PARSE ARG DirName
119RETURN SUBSTR(DirName, 1, LASTPOS("\", DirName)-1)
120
121
122/*
123 * Prints out a short help on how to call this script.
124 */
125PrintUsage: PROCEDURE
126SAY "DocBook Framework for OS/2, DocBook --> XHTML Chunks"
127SAY "Usage: DB2XHTMLChunks <DocBook Source>"
128RETURN
129
Note: See TracBrowser for help on using the repository browser.