-
Notifications
You must be signed in to change notification settings - Fork 0
/
process_favicon.xml
84 lines (79 loc) · 2.9 KB
/
process_favicon.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
<?xml version="1.0" encoding="UTF-8"?>
<!--ant-->
<!--
This file is part of the DITA-OT Favicon Plug-in project.
See the accompanying LICENSE file for applicable licenses.
-->
<project
xmlns:if="ant:if"
xmlns:unless="ant:unless"
name="fox.jason.favicon">
<target name="favicon.init">
<property name="args.faviconroot" value="${dita.plugin.fox.jason.favicon.dir}/includes"/>
<property name="args.favicon" value="favicon.svg"/>
<!-- begin to check and init favicon relevant properties -->
<condition property="user.faviconpath.url">
<or>
<contains string="${args.faviconpath}" substring="http://"/>
<contains string="${args.faviconpath}" substring="https://"/>
</or>
</condition>
<condition property="args.faviconpath.absolute">
<isabsolute path="${args.faviconpath}"/>
</condition>
<!-- Set the faviconpath as default empty directory when there is no user
input faviconpath or user input faviconpath is a local absolute path. -->
<condition property="user.faviconpath" value="">
<or>
<not>
<isset property="args.faviconpath"/>
</not>
<isset property="args.faviconpath.absolute"/>
</or>
</condition>
<property name="user.faviconpath" value="${args.faviconpath}/"/>
<condition
property="args.favicon.real"
value="${args.faviconroot}${file.separator}${args.favicon}"
>
<isset property="args.faviconroot"/>
</condition>
<condition property="args.favicon.real" value="${args.favicon}">
<not>
<isset property="args.faviconroot"/>
</not>
</condition>
<available file="${args.favicon.real}" property="args.favicon.present" type="file"/>
<basename property="args.favicon.file.temp" file="${args.favicon}"/>
<condition property="args.favicon.file" value="${args.favicon.file.temp}">
<or>
<isset property="args.favicon.present"/>
<isset property="user.faviconpath.url"/>
</or>
</condition>
<!-- end to check and init favicon relevant parameters -->
</target>
<target
name="favicon.copy"
unless="user.faviconpath.url"
description="Copy favicon file"
>
<local name="is.html.transform"/>
<condition property="is.html.transform">
<or>
<equals arg1="${out.ext}" arg2=".html"/>
<!-- add any additional missing transtypes here -->
<contains string="${transtype}" substring="HTML" casesensitive="no"/>
<contains string="${transtype}" substring="eclipsehelp" casesensitive="no"/>
</or>
</condition>
<property
name="user.faviconpath.real"
location="${dita.output.dir}/${user.faviconpath}"
/>
<mkdir dir="${user.faviconpath.real}" if:set="is.html.transform"/>
<copy todir="${user.faviconpath.real}" if:set="is.html.transform">
<fileset dir="${args.faviconroot}" includes="${args.favicon}" />
</copy>
</target>
</project>