source: trunk/Distribution/Scripts/DB2XHTML.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.1 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 single XHTML file.
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/DB2XHTML.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 InputFile = WORD(Arguments, 1)
40 OutputFile = SUBSTR(InputFile, 1, LASTPOS(".", InputFile)-1) || ".XHTML"
41 CALL Saxon "-o " || OutputFile || " " || InputFile || " " || RootDir || "\XSL\xhtml\docbook.xsl use.extensions=1"
42 END
43 ELSE DO
44 CALL PrintUsage
45 END
46
47CALL EndLocal
48EXIT
49
50
51/***********************************************************************************************/
52/* Procedures and functions */
53/***********************************************************************************************/
54
55
56/*
57 * Sets an environment variable or appends a value to it.
58 */
59AddEnvironment: PROCEDURE
60PARSE ARG VarName, VarValue
61IF (Value(VarName, , "OS2ENVIRONMENT")="")
62 THEN CALL SetEnvironment VarName, VarValue
63 ELSE CALL Value VarName, GetEnvironment(VarName) || ";" || VarValue, "OS2ENVIRONMENT"
64RETURN
65
66
67/*
68 * Sets an environment variable, overwriting its previous value.
69 */
70SetEnvironment: PROCEDURE
71PARSE ARG VarName, VarValue
72CALL Value VarName, VarValue, "OS2ENVIRONMENT"
73RETURN
74
75
76/*
77 * Returns the value of an environment variable.
78 */
79GetEnvironment: PROCEDURE
80PARSE ARG VarName
81RETURN Value(VarName, , "OS2ENVIRONMENT")
82
83
84/*
85 * Returns the current script name.
86 */
87GetScriptName: PROCEDURE
88PARSE SOURCE Result
89RETURN WORD(Result, 3)
90
91
92/*
93 * Returns the current script path, without "\" at the end.
94 */
95GetScriptPath: PROCEDURE
96ScriptName = GetScriptName()
97RETURN SUBSTR(ScriptName, 1, LASTPOS("\", ScriptName)-1)
98
99
100/*
101 * Returns True if the given file exists.
102 */
103FileExists: PROCEDURE
104PARSE ARG FileName
105CALL SysFileTree FileName, Result
106RETURN Result.0 > 0
107
108
109/*
110 * Returns the current directory, without "\" at the end.
111 */
112GetCurrentDir: PROCEDURE
113RETURN DIRECTORY()
114
115
116/*
117 * Returns the parent directory of the directory passed as argument, without "\" at the end.
118 */
119GetParentDirectory: PROCEDURE
120PARSE ARG DirName
121RETURN SUBSTR(DirName, 1, LASTPOS("\", DirName)-1)
122
123
124/*
125 * Prints out a short help on how to call this script.
126 */
127PrintUsage: PROCEDURE
128SAY "DocBook Framework for OS/2, DocBook --> XHTML"
129SAY "Usage: DB2XHTML <DocBook Source>"
130RETURN
131
Note: See TracBrowser for help on using the repository browser.