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