-
Notifications
You must be signed in to change notification settings - Fork 4
/
process_pandoc.xml
95 lines (92 loc) · 2.53 KB
/
process_pandoc.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
<?xml version="1.0" encoding="UTF-8"?>
<!--ant-->
<!--
This file is part of the DITA-OT Pandoc Plug-in project.
See the accompanying LICENSE file for applicable licenses.
-->
<project
name="fox.jason.passthrough.pandoc"
xmlns:if="ant:if"
xmlns:unless="ant:unless"
xmlns:pandoc="antlib:fox.jason.passthrough.pandoc"
default="pandoc.process"
>
<!--
Setting up Pandoc processing. Check that Pandoc is installed
-->
<target
name="pandoc.check"
description="Ensure that Pandoc is available">
<property
file="${dita.plugin.fox.jason.passthrough.pandoc.dir}/cfg/configuration.properties"
/>
<property name="pandoc.dir" value=""/>
<!-- For Unix, run Pandoc as an executable assuming it is on the classpath -->
<exec
if:blank="${pandoc.dir}"
executable="pandoc"
dir="${dita.dir}"
osfamily="unix"
taskname="pandoc"
resultproperty="pandoc.result"
outputproperty="pandoc.out"
failonerror="false"
failifexecutionfails="false"
>
<arg line="-v"/>
</exec>
<!-- For Unix, run Pandoc as an executable from a defined directory-->
<exec
unless:blank="${pandoc.dir}"
executable="pandoc"
dir="${pandoc.dir}"
osfamily="unix"
taskname="pandoc"
resultproperty="pandoc.result"
outputproperty="pandoc.out"
failonerror="false"
failifexecutionfails="false"
>
<arg line="-v"/>
</exec>
<!-- For Windows run from a DOS command -->
<exec
executable="cmd"
dir="${dita.dir}"
osfamily="windows"
taskname="pandoc"
resultproperty="pandoc.result"
outputproperty="pandoc.out"
failonerror="false"
failifexecutionfails="false"
>
<arg value="/C"/>
<arg value="${pandoc.dir}pandoc -v"/>
</exec>
<condition property="pandoc.installed">
<equals arg1="${pandoc.result}" arg2="0"/>
</condition>
<dita-ot-echo unless:set="pandoc.installed" id="PAND001W"/>
<echo
if:set="pandoc.installed"
taskname="pandoc"
level="info"
message="${pandoc.out}"
/>
</target>
<!--
Iterate across all files marked format="pandoc" and process them
-->
<target name="pandoc.process">
<property name="passthrough.input" value=""/>
<property name="passthrough.output" value=""/>
<property name="passthrough.title" value=""/>
<property file="${basedir}/cfg/configuration.properties"/>
<property name="pandoc.dir" value=""/>
<pandoc:add-file
src="${passthrough.input}"
dest="${passthrough.output}"
title="${passthrough.title}"
/>
</target>
</project>