Removed parameter imageCopyDir

Now, configurable in rackspace-library.xpl. Derived from value of 'htmlContentDir'.
This commit is contained in:
Salman Qureshi
2012-09-17 17:16:53 +05:00
parent 042372089c
commit 37ef230b58
4 changed files with 5 additions and 21 deletions

View File

@@ -154,13 +154,6 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
*/ */
private String replacementsFile; private String replacementsFile;
/**
* @parameter
* expression="${generate-webhelp.imageCopyDir}"
* default-value=""
*/
private String imageCopyDir;
/** /**
* @parameter * @parameter
* expression="${generate-webhelp.makePdf}" * expression="${generate-webhelp.makePdf}"
@@ -471,13 +464,11 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
String pathToPipelineFile = "classpath:/webhelp.xpl"; //use "classpath:/path" for this to work String pathToPipelineFile = "classpath:/webhelp.xpl"; //use "classpath:/path" for this to work
Source source = super.createSource(inputFilename, sourceFile, filter); Source source = super.createSource(inputFilename, sourceFile, filter);
Map map=new HashMap<String, String>(); Map<String, String> map=new HashMap<String, String>();
map.put("security", this.security); map.put("security", this.security);
map.put("canonicalUrlBase", this.canonicalUrlBase); map.put("canonicalUrlBase", this.canonicalUrlBase);
map.put("replacementsFile", this.replacementsFile); map.put("replacementsFile", this.replacementsFile);
//This is where the images will be copied in the target. This is a POM configuration.
map.put("imageCopyDir", this.imageCopyDir);
map.put("failOnValidationError", this.failOnValidationError); map.put("failOnValidationError", this.failOnValidationError);
map.put("project.build.directory", this.projectBuildDirectory); map.put("project.build.directory", this.projectBuildDirectory);
map.put("inputSrcFile", inputFilename); map.put("inputSrcFile", inputFilename);
@@ -522,8 +513,8 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
} }
} }
//targetExtQueryFile can tell us where the html will be built. Comparing this with the imageCopyDir path //targetExtQueryFile can tell us where the html will be built. We pass this absolute path to the
//we can figure out the relative path of the images to the html output. So passing the path to the content dir to the pipeline. //pipeline so that the copy-and-transform-image step can use it to calculate where to place the images.
String targetExtQueryFile = (String) map.get("targetExtQueryFile"); String targetExtQueryFile = (String) map.get("targetExtQueryFile");
int pos = targetExtQueryFile.lastIndexOf(File.separator); int pos = targetExtQueryFile.lastIndexOf(File.separator);
targetExtQueryFile = targetExtQueryFile.substring(0, pos); targetExtQueryFile = targetExtQueryFile.substring(0, pos);

View File

@@ -135,6 +135,7 @@ public class PDFBuilder {
// Extract all fonts into fonts directory // Extract all fonts into fonts directory
// //
FileUtils.extractJaredDirectory("fonts",PDFBuilder.class,imageParentDirectory); FileUtils.extractJaredDirectory("fonts",PDFBuilder.class,imageParentDirectory);
System.out.println("************************************** HELLO WORLD **************************************");
} }
public File processSources(Map<String,String> map) throws MojoExecutionException{ public File processSources(Map<String,String> map) throws MojoExecutionException{

View File

@@ -78,15 +78,12 @@ public class CopyAndTransformXProcStep extends DefaultStep {
private URI getTargetDirectoryURI() { private URI getTargetDirectoryURI() {
RuntimeValue target = getOption(_target); RuntimeValue target = getOption(_target);
URI uri = target.getBaseURI().resolve(target.getString()); URI uri = target.getBaseURI().resolve(target.getString());
return uri; return uri;
} }
private URI getTargetHtmlContentDirectoryURI() { private URI getTargetHtmlContentDirectoryURI() {
RuntimeValue target = getOption(_targetHtmlContentDir); RuntimeValue target = getOption(_targetHtmlContentDir);
URI uri = target.getBaseURI().resolve(target.getString()); URI uri = target.getBaseURI().resolve(target.getString());
File ttt = new File(uri);
System.out.println(ttt.getAbsolutePath());
return uri; return uri;
} }

View File

@@ -819,17 +819,12 @@
<p:variable name="input.docbook.file" select="//c:param[@name = 'inputSrcFile']/@value"> <p:variable name="input.docbook.file" select="//c:param[@name = 'inputSrcFile']/@value">
<p:pipe step="params" port="parameters"/> <p:pipe step="params" port="parameters"/>
</p:variable> </p:variable>
<p:variable name="image.copy.dir" select="//c:param[@name = 'imageCopyDir']/@value">
<p:pipe step="params" port="parameters"/>
</p:variable>
<!-- this param is passed by WebhelpMojo and contains the path where final html output will be written.
Comparing this path with the image copy dir param, we can find the relative path of the images to html -->
<p:variable name="target.html.content.dir" select="//c:param[@name = 'targetHtmlContentDir']/@value"> <p:variable name="target.html.content.dir" select="//c:param[@name = 'targetHtmlContentDir']/@value">
<p:pipe step="params" port="parameters"/> <p:pipe step="params" port="parameters"/>
</p:variable> </p:variable>
<cx:copy-transform name="loop"> <cx:copy-transform name="loop">
<p:with-option name="target" select="concat('file://',$project.build.directory,'/',$image.copy.dir)"/> <p:with-option name="target" select="concat('', 'file:///home/mtariq/Projects/rackspace/compute-api/openstack-compute-api-2/target/docbkx/webhelp/api/openstack-compute/2')"/>
<p:with-option name="targetHtmlContentDir" select="concat('file://',$target.html.content.dir)"/> <p:with-option name="targetHtmlContentDir" select="concat('file://',$target.html.content.dir)"/>
<p:with-option name="inputFileName" select="concat($input.docbook.file,'')"/> <p:with-option name="inputFileName" select="concat($input.docbook.file,'')"/>
<p:with-option name="outputType" select="concat($output.type,'')"/> <p:with-option name="outputType" select="concat($output.type,'')"/>