|
6 | 6 | <antlib xmlns:if="ant:if" xmlns:unless="ant:unless">
|
7 | 7 |
|
8 | 8 | <!--
|
9 |
| - Converts a value to result as generated by unix machines |
| 9 | + Returns the relative path of the src file |
10 | 10 |
|
11 |
| - @param string - The value to convert |
| 11 | + @param src - The value to convert |
12 | 12 | @param to - The property to set
|
13 | 13 | -->
|
14 |
| - <scriptdef language="javascript" name="relative-path" src="${dita.plugin.fox.jason.passthrough.pandoc.dir}/resource/relative.js"> |
| 14 | + <scriptdef language="javascript" name="relative-path" src="${dita.plugin.fox.jason.passthrough.pandoc.dir}/resource/relative-path.js"> |
15 | 15 | <attribute name="src" />
|
16 | 16 | <attribute name="to" />
|
17 | 17 | </scriptdef>
|
18 | 18 |
|
| 19 | + <!-- |
| 20 | + Converts a URI to make it relative to the ditamap root |
| 21 | +
|
| 22 | + @param path - The relative path of the file |
| 23 | + @param href - The relative path of the image |
| 24 | + --> |
| 25 | + <scriptdef language="javascript" name="amend-uri" src="${dita.plugin.fox.jason.passthrough.pandoc.dir}/resource/amend-uri.js"> |
| 26 | + <attribute name="path" /> |
| 27 | + <attribute name="href" /> |
| 28 | + <attribute name="to" /> |
| 29 | + </scriptdef> |
| 30 | + |
19 | 31 |
|
20 | 32 | <!--
|
21 | 33 | Individual file processing for pandoc.
|
|
124 | 136 | <actions>
|
125 | 137 | <local name="pandoc.image"/>
|
126 | 138 | <local name="pandoc.image.exists"/>
|
| 139 | + <local name="pandoc.image.uri"/> |
127 | 140 |
|
128 | 141 |
|
129 | 142 | <condition property="pandoc.image" value="${src.dir}/@{href}">
|
|
133 | 146 | </and>
|
134 | 147 | </condition>
|
135 | 148 |
|
136 |
| - |
137 |
| - <echo level="error" message="${pandoc.image}"/> |
138 |
| - <echo level="error" message="${copy-image.todir}${relative.path}@{href}"/> |
139 |
| - |
140 | 149 | <copy taskname="pandoc.copy-image" if:set="pandoc.image" toFile="${copy-image.todir}${relative.path}/@{href}" failonerror="false" file="${pandoc.image}"/>
|
| 150 | + |
| 151 | + <amend-uri path="${relative.path}" href="@{href}" to="pandoc.image.uri" /> |
| 152 | + <xmltask unless:set="copy-image.todir" taskname="update-uri" source="@{dest}" dest="@{dest}"> |
| 153 | + <attr path="//image[@href='@{href}']" attr="href" value="${pandoc.image.uri}" /> |
| 154 | + </xmltask> |
| 155 | + |
141 | 156 | </actions>
|
142 | 157 | </call>
|
143 | 158 | </xmltask>
|
|
0 commit comments