aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2003-11-22 19:48:21 +0000
committerJeremias Maerki <jeremias@apache.org>2003-11-22 19:48:21 +0000
commit85469d276ba93487b8b66af42f3fcb56ffbe6786 (patch)
treec5126af34947aaed5cd0a797acb2394a9107cde2 /src/java/org/apache/fop
parent086560195d5dab35f5501a1c5b0af23b30af4952 (diff)
downloadxmlgraphics-fop-85469d276ba93487b8b66af42f3fcb56ffbe6786.tar.gz
xmlgraphics-fop-85469d276ba93487b8b66af42f3fcb56ffbe6786.zip
New feature for the Ant task: relativebase="true" uses the directory of each FO-file in a fileset as basedir. This is in contrast to the general basedir parameter.
Submitted by: Joe DeVivo <fop.at.joedevivo.com> git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197021 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r--src/java/org/apache/fop/tools/anttasks/Fop.java30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/tools/anttasks/Fop.java b/src/java/org/apache/fop/tools/anttasks/Fop.java
index 9cd1d4fb5..9622c1fad 100644
--- a/src/java/org/apache/fop/tools/anttasks/Fop.java
+++ b/src/java/org/apache/fop/tools/anttasks/Fop.java
@@ -85,6 +85,8 @@ import org.apache.avalon.framework.logger.Logger;
* <li>format -> MIME type of the format to generate ex. "application/pdf"</li>
* <li>outfile -> output filename</li>
* <li>baseDir -> directory to work from</li>
+ * <li>relativebase -> (true | false) control whether to use each FO's
+ * directory as base directory. false uses the baseDir parameter.</li>
* <li>userconfig -> file with user configuration (same as the "-c" command
* line option)</li>
* <li>messagelevel -> (error | warn | info | verbose | debug) level to output
@@ -105,6 +107,7 @@ public class Fop extends Task {
private int messageType = Project.MSG_VERBOSE;
private boolean logFiles = true;
private boolean force = false;
+ private boolean relativebase = false;
/**
* Sets the filename for the userconfig.xml.
@@ -155,6 +158,25 @@ public class Fop extends Task {
}
/**
+ * Set whether to include files (external-grpahics, instream-foreign-object)
+ * from a path relative to the .fo file (true) or the working directory (false, default)
+ * only useful for filesets
+ *
+ * @param relbase true if paths are relative to file.
+ */
+ public void setRelativebase(boolean relbase) {
+ this.relativebase = relbase;
+ }
+
+ /**
+ * Gets the relative base attribute
+ * @return the relative base attribute
+ */
+ public boolean getRelativebase() {
+ return relativebase;
+ }
+
+ /**
* Set whether to check dependencies, or to always generate;
* optional, default is false.
*
@@ -429,7 +451,6 @@ class FOPTaskStarter extends AbstractLogEnabled {
if (task.getOutdir() != null) {
outf = new File(task.getOutdir(), outf.getName());
}
-
// Render if "force" flag is set OR
// OR output file doesn't exist OR
// output file is older than input file
@@ -437,7 +458,8 @@ class FOPTaskStarter extends AbstractLogEnabled {
|| (task.getFofile().lastModified() > outf.lastModified() )) {
render(task.getFofile(), outf, rint);
actioncount++;
- } else if (outf.exists() && (task.getFofile().lastModified() <= outf.lastModified() )) {
+ } else if (outf.exists()
+ && (task.getFofile().lastModified() <= outf.lastModified() )) {
skippedcount++;
}
}
@@ -468,6 +490,10 @@ class FOPTaskStarter extends AbstractLogEnabled {
}
try {
+ if (task.getRelativebase()) {
+ this.baseURL = f.getParentFile().toURL().
+ toExternalForm();
+ }
if (this.baseURL == null) {
this.baseURL = fs.getDir(task.getProject()).toURL().
toExternalForm();