VirtualBox

source: vbox/trunk/src/libs/dita-ot-1.8.5/doc/readme/creating-an-ant-build-script.html@ 99507

最後變更 在這個檔案從99507是 98584,由 vboxsync 提交於 2 年 前

Docs: bugref:10302. Setting svn properties of DITA-OT library.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 9.7 KB
 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE html
3 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4<html xml:lang="en-us" lang="en-us">
5<head>
6<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7<meta name="copyright" content="(C) Copyright 2005"/>
8<meta name="DC.rights.owner" content="(C) Copyright 2005"/>
9<meta name="DC.Type" content="task"/>
10<meta name="DC.Title" content="Creating an Ant build script"/>
11<meta name="abstract" content="Instead of typing the DITA-OT parameters at the command prompt, you might want to create an Ant build script that contains all of the parameters."/>
12<meta name="description" content="Instead of typing the DITA-OT parameters at the command prompt, you might want to create an Ant build script that contains all of the parameters."/>
13<meta name="DC.Relation" scheme="URI" content="../readme/DITA-ant.html"/>
14<meta name="DC.Relation" scheme="URI" content="../readme/DITA-antuse.html"/>
15<meta name="DC.Relation" scheme="URI" content="../readme/ant.html"/>
16<meta name="DC.Relation" scheme="URI" content="../readme/dita-ot_ant_properties.html"/>
17<meta name="DC.Relation" scheme="URI" content="http://ant.apache.org/manual/index.html"/>
18<meta name="DC.Format" content="XHTML"/>
19<meta name="DC.Identifier" content="creating-an-ant-build-script"/>
20<link rel="stylesheet" type="text/css" href="../commonltr.css"/>
21<link rel="stylesheet" type="text/css" href="../dita-ot-doc.css"/>
22<title>Creating an Ant build script</title>
23</head>
24<body id="creating-an-ant-build-script">
25
26
27 <h1 class="title topictitle1">Creating an Ant build script</h1>
28
29
30 <div class="body taskbody"><p class="shortdesc">Instead of typing the DITA-OT parameters at the command prompt, you might want to
31 create an Ant build script that contains all of the parameters.</p>
32
33 <div class="tasklabel"><h2 class="sectiontitle tasklabel">Procedure</h2></div><ol class="ol steps"><li class="li step stepexpand">
34 <span class="ph cmd">Create an XML file that contains the following content:</span>
35 <div class="itemgroup info">
36 <pre class="pre codeblock">&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
37&lt;project name="@project-name@" default="@default-target@" basedir="."&gt;
38
39 &lt;property name="dita.dir" location="@path-to-DITA-OT@"/&gt;
40
41 &lt;target name="@target-name@"&gt;
42 &lt;ant antfile="${dita.dir}${file.separator}build.xml"&gt;
43 &lt;property name="args.input" value="@DITA-input@"/&gt;
44 &lt;property name="transtype" value="xhtml"/&gt;
45 &lt;/ant&gt;
46 &lt;/target&gt;
47
48&lt;/project&gt;</pre>
49
50 </div>
51 <div class="itemgroup info">You will replace the placeholder content (indicated by the @ signs) with
52 content applicable to your environment.</div>
53 </li>
54<li class="li step stepexpand">
55 <span class="ph cmd">Specify project information:</span>
56 <ol type="a" class="ol substeps">
57 <li class="li substep substepexpand">
58 <span class="ph cmd">Set the value of the @name attribute to X.</span>
59 </li>
60
61 <li class="li substep substepexpand">
62 <span class="ph cmd">Set the value of the @default attribute to the name of a target in the
63 build script.</span>
64 <div class="itemgroup info">If the build script is invoked without specifying a target, this
65 target will be run.</div>
66 </li>
67
68 </ol>
69
70 </li>
71<li class="li step stepexpand">
72 <span class="ph cmd">Set the value of the <span class="keyword parmname">dita.dir</span> property to the location of
73 the DITA-OT.</span>
74 <div class="itemgroup info">This can be a fully qualified path, or you can specify it relative to the
75 location of the Ant build script that you are writing. </div>
76 </li>
77<li class="li step stepexpand">
78 <span class="ph cmd">Create the Ant target:</span>
79 <ol type="a" class="ol substeps">
80 <li class="li substep">
81 <span class="ph cmd">Set the value of the @name attribute.</span>
82 </li>
83
84 <li class="li substep">
85 <span class="ph cmd">Specify the value for the <span class="keyword parmname">args.input</span>
86 property.</span>
87 </li>
88
89 <li class="li substep">
90 <span class="ph cmd">Specify the value of the <span class="keyword parmname">transtype</span> property.</span>
91 </li>
92
93 </ol>
94
95 </li>
96<li class="li step stepexpand">
97 <span class="ph cmd">Save the build script.</span>
98 </li>
99</ol>
100
101 <div class="example"><div class="tasklabel"><h2 class="sectiontitle tasklabel">Example</h2></div>
102 <div class="p">The following Ant build script generates CHM and PDF output for the
103 <span class="ph filepath">userguide.ditamap</span>
104 file.<pre class="pre codeblock">&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
105&lt;project name="Toolkit-documentation" default="all" basedir="."&gt;
106
107 &lt;property name="dita.dir" location="C:\DITA-OT1.6.M5"/&gt;
108
109 &lt;target name="all" description="build CHM and PDF" depends="chm,pdf"/&gt;
110
111 &lt;target name="chm" description="build CHM"&gt;
112 &lt;ant antfile="${dita.dir}\build.xml"&gt;
113 &lt;property name="args.input" value="C:\dita-ot\src\main\doc\userguide.ditamap"/&gt;
114 &lt;property name="args.gen.task.lbl" value="YES"/&gt;
115 &lt;property name="output.dir" value="C:\kje\temp\out"/&gt;
116 &lt;property name="transtype" value="htmlhelp"/&gt;
117 &lt;/ant&gt;
118 &lt;/target&gt;
119
120 &lt;target name="pdf" description="build PDF"&gt;
121 &lt;ant antfile="${dita.dir}\build.xml"&gt;
122 &lt;property name="args.input" value="C:\dita-ot\src\main\doc\userguide.ditamap"/&gt;
123 &lt;property name="args.gen.task.lbl" value="YES"/&gt;
124 &lt;property name="args.rellinks" value="nofamily"/&gt;
125 &lt;property name="output.dir" value="C:\kje\temp\out"/&gt;
126 &lt;property name="transtype" value="pdf"/&gt;
127 &lt;/ant&gt;
128 &lt;/target&gt;
129
130&lt;/project&gt;</pre>
131</div>
132
133 <div class="p">In addition to the mandatory parameters (<span class="keyword parmname">args.input</span> and
134 <span class="keyword parmname">transtype</span>), the chm and pdf targets each specify some
135 optional parameters:<ul class="ul">
136 <li class="li">The <span class="keyword parmname">args.gen.task.lbl</span> property is set to YES, which
137 ensures that headings are automatically generated for the sections of task
138 topics.</li>
139
140 <li class="li">The <span class="keyword parmname">output.dir</span> property specifies where the DITA OT
141 writes the output of the transformations.</li>
142
143 </ul>
144</div>
145
146 <p class="p">The pdf target also specifies that related links should be generated in the PDF, but
147 only those links that are created by relationship tables and &lt;link&gt; elements.</p>
148
149 <p class="p">Finally, the all target simply specifies that both the chm and pdf target should be
150 run.</p>
151
152 </div>
153
154 <div class="section postreq"><div class="tasklabel"><h2 class="sectiontitle tasklabel">What to do next</h2></div>Another resource for learning about Ant scripts are the files in the
155 <span class="ph filepath">samples/ant_samples</span> directory. This directory contains the Ant
156 build files used by the demo build, as well as templates that you can use to create Ant
157 scripts.</div>
158
159 </div>
160
161<div class="related-links">
162<div class="familylinks">
163<div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../readme/DITA-ant.html" title="You can use Ant to invoke the DITA Open Toolkit (DITA-OT) and generate output. This is the most robust method of transforming DITA content; you can use the complete set of parameters that are supported by the toolkit.">Publishing DITA content from Ant</a></div>
164</div>
165<div class="relinfo relconcepts"><strong>Related concepts</strong><br/>
166<div><a class="link" href="../readme/ant.html" title="Ant is a Java-based, open-source tool that is provided by the Apache Foundation. It can be used to declare a sequence of build actions. It is well suited for both development and document builds. The full-easy-install version of the toolkit ships with a copy of Ant.">Ant</a></div>
167</div>
168<div class="relinfo reltasks"><strong>Related tasks</strong><br/>
169<div><a class="link" href="../readme/DITA-antuse.html" title="You can build output by running the ant command and specifying the DITA-OT parameters at the command prompt. You also can use an Ant build script to provide the DITA-OT parameters">Building output using Ant</a></div>
170</div>
171<div class="relinfo relref"><strong>Related reference</strong><br/>
172<div><a class="link" href="../readme/dita-ot_ant_properties.html" title="Certain parameters apply to all DITA-OT transformations. Other parameters are common to the HTML-based transformations. Finally, some parameters apply only to the specific transformation types.">Ant parameters</a></div>
173<div><a class="link" href="http://ant.apache.org/manual/index.html" target="_blank">Apache Ant documentation</a></div>
174</div>
175</div>
176
177</body>
178</html>
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette