-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild_ditasearch_template.xml
109 lines (101 loc) · 4.83 KB
/
build_ditasearch_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
<?xml version="1.0" encoding="UTF-8"?>
<project name="build_ditasearch_targets" basedir="."
xmlns:dita="http://dita-ot.sourceforge.net">
<target name="ditasearch"
dita:depends="
ditasearch-init,
{com.taylortext.ditasearch.pre},
ditasearch-searchindex,
{com.taylortext.ditasearch.post}
"
dita:extension="depends org.dita.dost.platform.InsertDependsAction">
<dita:extension id="com.taylortext.ditasearch.pre" behavior="org.dita.dost.platform.InsertAction"/>
<dita:extension id="com.taylortext.ditasearch.post" behavior="org.dita.dost.platform.InsertAction"/>
</target>
<target name="ditasearch-init">
<condition property="ditasearch-gen-index">
<!-- proxy test for an HTML-type transformation -->
<or>
<equals arg1="${transtype}" arg2="html5"/>
<isset property="args.css"/>
<isset property="args.ftr"/>
<isset property="args.hdf"/>
<isset property="args.hdr"/>
<isset property="args.html5.toc"/>
<isset property="args.outext"/>
</or>
</condition>
</target>
<target name="ditasearch-genlist">
<xslt basedir="${dita.temp.dir}"
includesfile="${dita.temp.dir}/fullditamap.list"
destdir="${dita.temp.dir}"
style="${dita.plugin.com.taylortext.ditasearch.dir}/xsl/gen-nosearch-list.xsl"
failOnError="true" extension=".nosearch">
<xmlcatalog refid="dita.catalog"/>
</xslt>
<concat destfile="${dita.temp.dir}/nosearch.list" fixlastline="yes">
<path>
<fileset dir="${dita.temp.dir}">
<include name="*.nosearch"/>
<include name="resourceonly.list"/>
</fileset>
</path>
<filterchain><!-- sort list entries and remove duplicates -->
<sortfilter/>
<tokenfilter>
<uniqfilter/>
</tokenfilter>
</filterchain>
</concat>
<loadfile property="nosearchlist" srcfile="${dita.temp.dir}/nosearch.list"/>
</target>
<target name="ditasearch-searchindex" if="${ditasearch-gen-index}" description="Generate a JSON index of the help content." >
<antcall target="ditasearch-genlist"/>
<antcall target="ditasearch-configfile"/>
<!-- Index each topic individually first -->
<xslt basedir="${dita.temp.dir}"
includesfile="${dita.temp.dir}/fullditatopic.list"
excludesfile="${dita.temp.dir}/nosearch.list"
destdir="${dita.temp.dir}"
style="${dita.plugin.com.taylortext.ditasearch.dir}/xsl/stemmer.xsl"
filenameparameter="thisindextarget"
filedirparameter="thisindexpath"
failOnError="false" extension=".idx">
<param name="OUTEXT" expression="${out.ext}" if="out.ext"/>
<param name="configfile" expression="${dita.temp.dir}/searchconfigs.xml"/>
<xmlcatalog refid="dita.catalog"/>
</xslt>
<!-- Combine topic indexes and search configs into a single file for further processing -->
<concat destfile="${dita.temp.dir}/ditasearch.xml">
<fileset dir="${dita.temp.dir}">
<include name="**/*.idx"/>
<include name="searchconfigs.xml"/>
</fileset>
<header filtering="no"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<indextopics>]]></header>
<footer filtering="no"><![CDATA[</indextopics>]]></footer>
</concat>
<!-- Add index and config data to the script -->
<xslt in="${dita.temp.dir}/ditasearch.xml"
out="${output.dir}/ditasearch.js"
style="${dita.plugin.com.taylortext.ditasearch.dir}/xsl/index2js.xsl"
failOnError="true">
<param name="scriptfile" expression="${dita.plugin.com.taylortext.ditasearch.dir}/js/ditasearch.js"/>
<xmlcatalog refid="dita.catalog"/>
</xslt>
</target>
<target name="ditasearch-configfile" description="Combine user and default search configs.">
<condition property="configfile.found" value="true" else="false">
<available file="${args.ditasearch.configs}"/>
</condition>
<xslt in="${dita.plugin.com.taylortext.ditasearch.dir}/default-configs.xml"
out="${dita.temp.dir}/searchconfigs.xml"
style="${dita.plugin.com.taylortext.ditasearch.dir}/xsl/init_searchconfigs.xsl"
failOnError="true">
<param name="configfile" expression="${args.ditasearch.configs}"/>
<param name="configfilefound" expression="${configfile.found}"/>
<xmlcatalog refid="dita.catalog"/>
</xslt>
</target>
</project>