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 |
|
---|
27 | OuterEnv = SetLocal()
|
---|
28 |
|
---|
29 | CALL RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
|
---|
30 | CALL SysLoadFuncs
|
---|
31 |
|
---|
32 | ScriptDir = GetScriptPath()
|
---|
33 | RootDir = GetParentDirectory(ScriptDir)
|
---|
34 |
|
---|
35 | Arguments = ARG(1)
|
---|
36 |
|
---|
37 | IF 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 |
|
---|
45 | CALL EndLocal
|
---|
46 | EXIT
|
---|
47 |
|
---|
48 |
|
---|
49 | /***********************************************************************************************/
|
---|
50 | /* Procedures and functions */
|
---|
51 | /***********************************************************************************************/
|
---|
52 |
|
---|
53 |
|
---|
54 | /*
|
---|
55 | * Sets an environment variable or appends a value to it.
|
---|
56 | */
|
---|
57 | AddEnvironment: PROCEDURE
|
---|
58 | PARSE ARG VarName, VarValue
|
---|
59 | IF (Value(VarName, , "OS2ENVIRONMENT")="")
|
---|
60 | THEN CALL SetEnvironment VarName, VarValue
|
---|
61 | ELSE CALL Value VarName, GetEnvironment(VarName) || ";" || VarValue, "OS2ENVIRONMENT"
|
---|
62 | RETURN
|
---|
63 |
|
---|
64 |
|
---|
65 | /*
|
---|
66 | * Sets an environment variable, overwriting its previous value.
|
---|
67 | */
|
---|
68 | SetEnvironment: PROCEDURE
|
---|
69 | PARSE ARG VarName, VarValue
|
---|
70 | CALL Value VarName, VarValue, "OS2ENVIRONMENT"
|
---|
71 | RETURN
|
---|
72 |
|
---|
73 |
|
---|
74 | /*
|
---|
75 | * Returns the value of an environment variable.
|
---|
76 | */
|
---|
77 | GetEnvironment: PROCEDURE
|
---|
78 | PARSE ARG VarName
|
---|
79 | RETURN Value(VarName, , "OS2ENVIRONMENT")
|
---|
80 |
|
---|
81 |
|
---|
82 | /*
|
---|
83 | * Returns the current script name.
|
---|
84 | */
|
---|
85 | GetScriptName: PROCEDURE
|
---|
86 | PARSE SOURCE Result
|
---|
87 | RETURN WORD(Result, 3)
|
---|
88 |
|
---|
89 |
|
---|
90 | /*
|
---|
91 | * Returns the current script path, without "\" at the end.
|
---|
92 | */
|
---|
93 | GetScriptPath: PROCEDURE
|
---|
94 | ScriptName = GetScriptName()
|
---|
95 | RETURN SUBSTR(ScriptName, 1, LASTPOS("\", ScriptName)-1)
|
---|
96 |
|
---|
97 |
|
---|
98 | /*
|
---|
99 | * Returns True if the given file exists.
|
---|
100 | */
|
---|
101 | FileExists: PROCEDURE
|
---|
102 | PARSE ARG FileName
|
---|
103 | CALL SysFileTree FileName, Result
|
---|
104 | RETURN Result.0 > 0
|
---|
105 |
|
---|
106 |
|
---|
107 | /*
|
---|
108 | * Returns the current directory, without "\" at the end.
|
---|
109 | */
|
---|
110 | GetCurrentDir: PROCEDURE
|
---|
111 | RETURN DIRECTORY()
|
---|
112 |
|
---|
113 |
|
---|
114 | /*
|
---|
115 | * Returns the parent directory of the directory passed as argument, without "\" at the end.
|
---|
116 | */
|
---|
117 | GetParentDirectory: PROCEDURE
|
---|
118 | PARSE ARG DirName
|
---|
119 | RETURN SUBSTR(DirName, 1, LASTPOS("\", DirName)-1)
|
---|
120 |
|
---|
121 |
|
---|
122 | /*
|
---|
123 | * Prints out a short help on how to call this script.
|
---|
124 | */
|
---|
125 | PrintUsage: PROCEDURE
|
---|
126 | SAY "DocBook Framework for OS/2, DocBook --> XHTML Chunks"
|
---|
127 | SAY "Usage: DB2XHTMLChunks <DocBook Source>"
|
---|
128 | RETURN
|
---|
129 |
|
---|