Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

aboutsummaryrefslogtreecommitdiffstats
blob: f81c30422c42fc84b68049fe60754d4a4e3c602d (plain) (blame)
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
<?xml version="1.0" encoding="UTF-8" ?>
<project name="build-dita" default="build_all" basedir=".">

	<property file="setup.properties" />
	<property file="build.properties" />
	<property file="${user.home}/.dita/cdo.properties" />

	<property name="project.root" location="${basedir}/.." />
	<property name="dita.root" location="${project.root}/${dita.path}" />
	<property name="docs.area.root" location="${project.root}/${docs.area.path}" />

	<property name="dita.ext" value=".dita" />
	<property name="target.ext" value=".topic" />

	<import file="${dita.root}/conductor.xml" />

	<!-- ********************************************************************************************************* -->
	<!-- ********************************************************************************************************* -->
	<!-- ********************************************************************************************************* -->
	<target name="build_all" depends="build_homepage, build_help" />

	<!-- ********************************************************************************************************* -->
	<!-- ********************************************************************************************************* -->
	<!-- ********************************************************************************************************* -->
	<target name="build_homepage" depends="init">
		<property name="target.dir" location="${docs.area.root}/manual_20" />
		<property name="temp.dir" value="${project.root}/.temp/manual_20/xhtml" />
		<delete dir="${temp.dir}" includeemptydirs="true" failonerror="false" />

		<!-- Transform dita sources to temp.dir (see http://dita-ot.sourceforge.net/doc/DITA-antscript.html for details) -->
		<antcall target="dita2xhtml">
			<param name="transtype" value="xhtml" />
			<param name="output.dir" value="${temp.dir}" />

			<param name="dita.extname" value="${dita.ext}" />
			<param name="args.input" value="${project.root}/src/toc.ditamap" />
			<param name="args.logdir" value="${project.root}/.log" />
			<param name="dita.temp.dir" value="${project.root}/.temp/.intermediate" />
			<param name="clean.temp" value="true" />
		</antcall>

		<!-- DITA always writes index.html, we need toc.html -->
		<move file="${temp.dir}/index.html" tofile="${temp.dir}/toc.html" failonerror="true" verbose="true" />

		<!-- Cut out the body contents -->
		<replaceregexp match=".*&lt;body[^>]*>(.*)&lt;/body>.*"
		               replace="&lt;!-- Generated -->\1"
		               flags="s"
		               byline="false">
			<fileset dir="${temp.dir}" includes="**/*.html" id="topics" />
		</replaceregexp>

		<!-- Convert relative node links to absolute (excluding first slash) -->
		<replaceregexp match="href=&quot;\?topic=\.\./" replace="href=&quot;\?topic=" flags="g">
			<fileset refid="topics" />
		</replaceregexp>

		<!-- Clean the target.dir
		<delete dir="${target.dir}" includeemptydirs="true" failonerror="false" />
		-->

		<!-- Move the topic files from temp.dir to target.dir (thereby renaming the extensions from .html to target.ext -->
		<move todir="${target.dir}" overwrite="true">
			<fileset dir="${temp.dir}" />
			<mapper type="glob" from="*.html" to="*${target.ext}" />
		</move>

		<!-- Move the additional resources from temp.dir to target.dir -->
		<move todir="${target.dir}" overwrite="true">
			<fileset dir="${temp.dir}" />
		</move>
	</target>

	<!-- ********************************************************************************************************* -->
	<!-- ********************************************************************************************************* -->
	<!-- ********************************************************************************************************* -->
	<target name="build_help" depends="init">
		<property name="target.dir" location="../help" />
		<!--
		<delete dir="${target.dir}" includeemptydirs="true" failonerror="false" />
		-->

		<!-- Transform dita sources to temp.dir (see http://dita-ot.sourceforge.net/doc/DITA-antscript.html for details) -->
		<antcall target="dita2eclipsehelp">
			<param name="transtype" value="eclipsehelp" />
			<param name="output.dir" value="${target.dir}" />

			<param name="dita.extname" value="${dita.ext}" />
			<param name="args.input" value="${project.root}/src/toc.ditamap" />
			<param name="args.logdir" value="${project.root}/.log" />
			<param name="dita.temp.dir" value="${project.root}/.temp/.intermediate" />
			<param name="clean.temp" value="true" />
		</antcall>

		<!-- Delete the generated plugin files -->
		<delete dir="${target.dir}/meta-inf/" failonerror="false" verbose="true" includeemptydirs="true" />
		<delete file="${target.dir}/plugin.xml" failonerror="false" verbose="true" />
		<delete file="${target.dir}/plugin.properties" failonerror="false" verbose="true" />

		<!-- In the topics replace the generated "../" paths with "help/"	-->
		<replaceregexp match="href=&quot;\?topic=\.\./([^&quot;]*)&quot;"
		               replace="href=&quot;../\1.html&quot;"
		               flags="g">
			<fileset dir="${target.dir}" includes="**/*html" />
		</replaceregexp>

		<!-- In the TOC prefix with "help/" -->
		<replace token="topic=&quot;" value="topic=&quot;help/" file="${target.dir}/toc.xml" />
		<replace token="href=&quot;" value="href=&quot;help/" file="${target.dir}/toc.xml" />
	</target>

	<!-- ********************************************************************************************************* -->
	<!-- ********************************************************************************************************* -->
	<!-- ********************************************************************************************************* -->
	<target name="init">
	</target>

</project>

Back to the top