-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_transtype-graphviz_template.xml
144 lines (119 loc) · 5.36 KB
/
build_transtype-graphviz_template.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<project name="dita2graphviz" default="dita2graphviz"
>
<!-- test to see where the plugin is located, plugins or demo -->
<dirname property="graphviz.dir" file="${ant.file.dita2graphviz}"/>
<!-- Controls debugging within the XSLTs. Set to "true" to turn on debugging: -->
<property name="debug" value="false"/>
<property name="graphviz.temp.dir" value="${dita.temp.dir}${file.separator}graphviz_temp"/>
<!-- This is the name of the graphviz "dot" program, which is used to generate
graph pictures from DOT (.gv) files. If it is not in your system PATH then
set this property to the absolute path to the executable.
-->
<property name="graphviz.dot.executable" value="/usr/local/bin/dot"/>
<property name="graphvizArgs" value=""/>
<target name="dita2graphviz"
unless="noMap"
xmlns:dita="http://dita-ot.sourceforge.net"
dita:depends="build-init, preprocess,graphviz"
dita:extension="depends org.dita.dost.platform.InsertDependsAction">
</target>
<target name="graphviz"
unless="noMap"
depends="dita.map.graphviz"/>
<target name="dita.map.graphviz.init"
description="Init properties for GraphViz">
<basename property="dita.map.toc.root"
file="${dita.input.filename}"
suffix=".ditamap" />
<condition property="args.graphviz.toc" value="${dita.map.toc.root}">
<not>
<isset property="args.graphviz.toc" />
</not>
</condition>
<condition property="out.ext" value=".gv">
<not>
<isset property="out.ext" />
</not>
</condition>
<condition property="noPlugin">
<equals arg1="${dita.graphviz.plugin}" arg2="no" />
</condition>
<!-- The output format to use for the generated graph.
Allowed values include "pdf", "svg", "jpg", and
"gv" (for DOT format normalized by the graphviz
programm.
The complete set of output types is determined by
how your local graphviz installation is configured.
-->
<condition property="graphviz.output.format" value="pdf">
<not>
<isset property="graphviz.output.format" />
</not>
</condition>
<condition property="graphviz.graph.type" value="navigation-map">
<not>
<isset property="graphviz.graph.type" />
</not>
</condition>
</target>
<target name="dita.map.graphviz" depends="dita.map.graphviz.init"
description="Generate graphviz data files from the input map">
<mkdir dir="${graphviz.temp.dir}"/>
<makeurl file="${graphviz.temp.dir}" property="graphviz.xslt.outdir"/>
<makeurl file="${dita.temp.dir}" property="graphviz.xslt.tempdir"/>
<property name="map2graphviz.style" location="${graphviz.dir}/xsl/map2graphviz.xsl"/>
<property name="graphviz.result.filename" value="${dita.map.filename.root}.${graphviz.output.format}"/>
<xslt processor="trax"
basedir="${dita.temp.dir}"
destdir="${output.dir}"
includesfile="${dita.temp.dir}${file.separator}fullditamap.list"
classpathref="dost.class.path"
style="${map2graphviz.style}">
<param name="debug" expression="${debug}"/>
<param name="tempdir" expression="${graphviz.xslt.tempdir}"/>
<param name="outdir" expression="${output.dir}"/>
<param name="rawPlatformString" expression="${os.name}"/>
<param name="graphType" expression="${graphviz.graph.type}"/>
<!-- Parameters from dita2xhtml and similar transtypes: -->
<param name="WORKDIR" expression="${workdir}" if="workdir"/>
<param name="DRAFT" expression="${args.draft}" if="args.draft"></param>
<param name="ARTLBL" expression="${args.artlbl}" if="args.artlbl"></param>
<param name="OUTPUTDIR" expression="${output.dir}"/>
<xmlcatalog refid="dita.catalog"></xmlcatalog>
</xslt>
<!-- Try to run the graphviz "dot" command. Graphviz is a separately-installed
program. It is open source and available for all platforms. See graphviz.org.
-->
<exec executable="${graphviz.dot.executable}"
resultproperty="resultCode"
failonerror="false">
<arg line="-O"/><!-- Generate appropriate output filename based on input file(s) -->
<arg line="-T${graphviz.output.format}"/>
<arg line="${graphvizArgs}"/>
<arg line="${output.dir}/${dita.map.filename.root}.html"/>
</exec>
<echo message="After graphviz processing, result code is '${resultCode}'"/>
</target>
<target name="graphviz.copy.graphics"
description="Copies graphics from input to the ePub output directory based on the graphic map generated during graphviz generation">
<ant antfile="${graphviz.temp.dir}/copy-graphics.xml"
>
</ant>
</target>
<target name="graphviz-copy-css" description="Copy CSS files">
<condition property="user.copycss.yes">
<isset property="args.css.present"/>
</condition>
<property name="user.csspath.real" value="${graphviz.temp.dir}/${topics.output.dir}/${user.csspath}"/>
<mkdir dir="${user.csspath.real}"/>
<!-- Always copy system default css files -->
<copy todir="${user.csspath.real}">
<fileset dir="${dita.plugin.org.dita.base.dir}" includes="*.css"/>
</copy>
<!-- Copy user specify css file when required -->
<antcall target="graphviz-copy-css-user"/>
</target>
<target name="graphviz-copy-css-user" if="user.copycss.yes">
<copy file="${args.css.real}" todir="${user.csspath.real}"/>
</target>
</project>