@@ -0,0 +1,1933 @@
+package org.dita.dost.util;%0A%0Aimport org.apache.commons.io.FilenameUtils;%0Aimport org.apache.tools.ant.Project;%0Aimport org.apache.tools.ant.util.*;%0Aimport org.dita.dost.invoker.ExtensibleAntInvoker;%0A%0Aimport java.io.File;%0Aimport java.net.URI;%0A%0Aimport static org.dita.dost.util.Constants.ANT_TEMP_DIR;%0Aimport static org.dita.dost.util.URLUtils.toFile;%0Aimport static org.dita.dost.util.URLUtils.toURI;%0A%0A/**%0A * File mapper that uses job configuration's %7B@link org.dita.dost.util.Job.FileInfo#result result%7D%0A * to resolve output file. If %7B@link org.dita.dost.util.Job.FileInfo#result result%7D is not defined,%0A * the original output filename is used.%0A *%0A * @since 3.0%0A */%0Apublic class JobMapper implements FileNameMapper %7B%0A%0A    private Job job;%0A    private String extension;%0A%0A    public void setProject(Project project) %7B%0A        File tempDir = new File(project.getProperty(ANT_TEMP_DIR));%0A        if (!tempDir.isAbsolute()) %7B%0A            tempDir = new File(project.getBaseDir(), tempDir.getPath());%0A        %7D%0A        job = ExtensibleAntInvoker.getJob(tempDir, project);%0A    %7D%0A%0A    @Override%0A    public void setFrom(String from) %7B%0A        // NOOP%0A    %7D%0A%0A    @Override%0A    public void setTo(String extension) %7B%0A        // FIXME this should use an extra attribute %60extension%60, but Ant doesn't support it%0A        this.extension = extension.charAt(0) == '.' ? extension : (%22.%22 + extension);%0A    %7D%0A%0A    @Override%0A    public String%5B%5D mapFileName(String sourceFileName) %7B%0A        final Job.FileInfo fi = job.getFileInfo(toURI(sourceFileName));%0A        final String res;%0A        if (fi.result == null) %7B%0A            res = sourceFileName;%0A        %7D else %7B%0A            final URI base = toURI(job.getProperty(%22user.input.dir.uri%22));%0A            final URI rel = base.relativize(fi.result);%0A            res = toFile(rel).getPath();%0A        %7D%0A        return new String%5B%5D%7Bextension != null ? (FilenameUtils.removeExtension(res) + extension) : res%7D;%0A    %7D%0A%7D%0A

Add job mapper