Support pdfFilenameBase param to control the base used
for the pdf file generated by autopdf.
This commit is contained in:
@@ -94,6 +94,14 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
|
|||||||
*/
|
*/
|
||||||
private String includeDateInPdfFilename;
|
private String includeDateInPdfFilename;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base for the pdf file name. By default this is the
|
||||||
|
* base of the input xml file.
|
||||||
|
*
|
||||||
|
* @parameter expression="${generate-webhelp.pdfFilenameBase}"
|
||||||
|
*/
|
||||||
|
private String pdfFilenameBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls whether output is colorized based on revisionflag attributes.
|
* Controls whether output is colorized based on revisionflag attributes.
|
||||||
*
|
*
|
||||||
@@ -452,7 +460,10 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
|
|||||||
}
|
}
|
||||||
transformer.setParameter("webhelp.war", webhelpWar);
|
transformer.setParameter("webhelp.war", webhelpWar);
|
||||||
|
|
||||||
transformer.setParameter("includeDateInPdfFilename", includeDateInPdfFilename);
|
if(null != includeDateInPdfFilename){
|
||||||
|
transformer.setParameter("includeDateInPdfFilename", includeDateInPdfFilename);
|
||||||
|
}
|
||||||
|
transformer.setParameter("pdfFilenameBase", pdfFilenameBase);
|
||||||
|
|
||||||
transformer.setParameter("publicationNotificationEmails", publicationNotificationEmails);
|
transformer.setParameter("publicationNotificationEmails", publicationNotificationEmails);
|
||||||
|
|
||||||
@@ -677,6 +688,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
|
|||||||
map.put("webhelp.war", webhelpWar);
|
map.put("webhelp.war", webhelpWar);
|
||||||
map.put("publicationNotificationEmails", publicationNotificationEmails);
|
map.put("publicationNotificationEmails", publicationNotificationEmails);
|
||||||
map.put("includeDateInPdfFilename", includeDateInPdfFilename);
|
map.put("includeDateInPdfFilename", includeDateInPdfFilename);
|
||||||
|
map.put("pdfFilenameBase", pdfFilenameBase);
|
||||||
map.put("groupId", docProject.getGroupId());
|
map.put("groupId", docProject.getGroupId());
|
||||||
map.put("artifactId", docProject.getArtifactId());
|
map.put("artifactId", docProject.getArtifactId());
|
||||||
map.put("docProjectVersion", docProject.getVersion());
|
map.put("docProjectVersion", docProject.getVersion());
|
||||||
@@ -769,6 +781,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
|
|||||||
pdfBuilder.setCoverLogoLeft(coverLogoLeft);
|
pdfBuilder.setCoverLogoLeft(coverLogoLeft);
|
||||||
pdfBuilder.setCoverLogoTop(coverLogoTop);
|
pdfBuilder.setCoverLogoTop(coverLogoTop);
|
||||||
pdfBuilder.setCoverUrl(coverUrl);
|
pdfBuilder.setCoverUrl(coverUrl);
|
||||||
|
pdfBuilder.setPdfFilenameBase(pdfFilenameBase);
|
||||||
|
|
||||||
pdfBuilder.setBranding(branding);
|
pdfBuilder.setBranding(branding);
|
||||||
pdfBuilder.setSecurity(security);
|
pdfBuilder.setSecurity(security);
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ public class PDFBuilder {
|
|||||||
private String statusBarText;
|
private String statusBarText;
|
||||||
private String trimWadlUriCount;
|
private String trimWadlUriCount;
|
||||||
private String computeWadlPathFromDocbookPath;
|
private String computeWadlPathFromDocbookPath;
|
||||||
|
private String pdfFilenameBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The location of the stylesheet customization.
|
* The location of the stylesheet customization.
|
||||||
@@ -194,8 +195,14 @@ public class PDFBuilder {
|
|||||||
final String inputFilename = included[i];
|
final String inputFilename = included[i];
|
||||||
|
|
||||||
//final String inputFilename = sourceFilePath;
|
//final String inputFilename = sourceFilePath;
|
||||||
// targetFilename is inputFilename - ".xml" + targetFile extension
|
// targetFilename is inputFilename - ".xml" + targetFile extension
|
||||||
String baseTargetFile = inputFilename.substring(0, inputFilename.length() - 4);
|
String baseTargetFile;
|
||||||
|
if(null != pdfFilenameBase && pdfFilenameBase != ""){
|
||||||
|
baseTargetFile = pdfFilenameBase;
|
||||||
|
} else {
|
||||||
|
baseTargetFile = inputFilename.substring(0, inputFilename.length() - 4);
|
||||||
|
}
|
||||||
|
|
||||||
final String targetFilename = baseTargetFile + ".fo";
|
final String targetFilename = baseTargetFile + ".fo";
|
||||||
|
|
||||||
final File sourceFile = new File(sourceDirectory+"/"+inputFilename);
|
final File sourceFile = new File(sourceDirectory+"/"+inputFilename);
|
||||||
@@ -412,7 +419,8 @@ public class PDFBuilder {
|
|||||||
transformer.setParameter("source.directory",sourceDirectory);
|
transformer.setParameter("source.directory",sourceDirectory);
|
||||||
|
|
||||||
transformer.setParameter("compute.wadl.path.from.docbook.path",computeWadlPathFromDocbookPath);
|
transformer.setParameter("compute.wadl.path.from.docbook.path",computeWadlPathFromDocbookPath);
|
||||||
|
transformer.setParameter("pdfFilenameBase",pdfFilenameBase)
|
||||||
|
;
|
||||||
transformer.setParameter ("admon.graphics.path", imageDirectory.getAbsolutePath()+File.separator);
|
transformer.setParameter ("admon.graphics.path", imageDirectory.getAbsolutePath()+File.separator);
|
||||||
transformer.setParameter ("callout.graphics.path", calloutDirectory.getAbsolutePath()+File.separator);
|
transformer.setParameter ("callout.graphics.path", calloutDirectory.getAbsolutePath()+File.separator);
|
||||||
|
|
||||||
@@ -710,6 +718,16 @@ public class PDFBuilder {
|
|||||||
this.computeWadlPathFromDocbookPath = computeWadlPathFromDocbookPath;
|
this.computeWadlPathFromDocbookPath = computeWadlPathFromDocbookPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPdfFilenameBase() {
|
||||||
|
return pdfFilenameBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPdfFilenameBase(
|
||||||
|
String pdfFilenameBase) {
|
||||||
|
this.pdfFilenameBase = pdfFilenameBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public List getEntities() {
|
public List getEntities() {
|
||||||
return entities;
|
return entities;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<xsl:param name="security">external</xsl:param>
|
<xsl:param name="security">external</xsl:param>
|
||||||
<xsl:param name="autoPdfUrl"/>
|
<xsl:param name="autoPdfUrl"/>
|
||||||
<xsl:param name="branding">rackspace</xsl:param>
|
<xsl:param name="branding">rackspace</xsl:param>
|
||||||
|
<xsl:param name="pdfFilenameBase"/>
|
||||||
<xsl:param name="includeDateInPdfFilename">
|
<xsl:param name="includeDateInPdfFilename">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$branding = 'openstack'">0</xsl:when>
|
<xsl:when test="$branding = 'openstack'">0</xsl:when>
|
||||||
@@ -27,6 +28,14 @@
|
|||||||
</xsl:param>
|
</xsl:param>
|
||||||
<xsl:param name="publicationNotificationEmails"/>
|
<xsl:param name="publicationNotificationEmails"/>
|
||||||
|
|
||||||
|
<xsl:variable name="pdfFilenameBaseCalculated">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="not($pdfFilenameBase='')"><xsl:value-of select="$pdfFilenameBase"/></xsl:when>
|
||||||
|
<xsl:when test="$autoPdfUrl != ''"><xsl:value-of select="substring($autoPdfUrl,4,string-length($autoPdfUrl) - 6)"/></xsl:when>
|
||||||
|
<xsl:otherwise><xsl:value-of select="$input.filename"/></xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
<!-- We need too collect lists that contain their own raxm:metadata so we can
|
<!-- We need too collect lists that contain their own raxm:metadata so we can
|
||||||
add <type>s to the bookinfo for resources mentioned in lists in the doc -->
|
add <type>s to the bookinfo for resources mentioned in lists in the doc -->
|
||||||
<xsl:variable name="resource-lists" select="//db:itemizedlist[db:info/raxm:metadata]"/>
|
<xsl:variable name="resource-lists" select="//db:itemizedlist[db:info/raxm:metadata]"/>
|
||||||
@@ -45,9 +54,9 @@
|
|||||||
href="{$base.dir}/bookinfo.xml"
|
href="{$base.dir}/bookinfo.xml"
|
||||||
method="xml" indent="yes" encoding="UTF-8">
|
method="xml" indent="yes" encoding="UTF-8">
|
||||||
<products xmlns="">
|
<products xmlns="">
|
||||||
<latestpdf><xsl:choose>
|
<latestpdf><xsl:value-of select="$pdfFilenameBaseCalculated"/>-latest.pdf</latestpdf><!-- <xsl:choose> -->
|
||||||
<xsl:when test="normalize-space($autoPdfUrl) != ''"><xsl:value-of select="substring($autoPdfUrl,4,string-length($autoPdfUrl) - 6)"/>-latest.pdf</xsl:when><xsl:otherwise><xsl:value-of select="$input.filename"/>.pdf</xsl:otherwise></xsl:choose></latestpdf>
|
<!-- <xsl:when test="normalize-space($autoPdfUrl) != ''"><xsl:value-of select="substring($autoPdfUrl,4,string-length($autoPdfUrl) - 6)"/>-latest.pdf</xsl:when><xsl:otherwise><xsl:value-of select="$pdfFilenameBaseCalculated"/>.pdf</xsl:otherwise></xsl:choose> -->
|
||||||
<pdfoutname><xsl:value-of select="concat($input.filename,$pdfsuffix,'.pdf')"/></pdfoutname>
|
<pdfoutname><xsl:value-of select="concat($pdfFilenameBaseCalculated,$pdfsuffix,'.pdf')"/></pdfoutname>
|
||||||
<docname><xsl:value-of select="/*/db:title|/*/db:info/db:title"/></docname>
|
<docname><xsl:value-of select="/*/db:title|/*/db:info/db:title"/></docname>
|
||||||
<productname><xsl:value-of select="f:productname(/*/db:info/raxm:metadata/raxm:product,/*/db:info/raxm:metadata/raxm:product/@version)"/></productname>
|
<productname><xsl:value-of select="f:productname(/*/db:info/raxm:metadata/raxm:product,/*/db:info/raxm:metadata/raxm:product/@version)"/></productname>
|
||||||
<webappname><xsl:value-of select="$input.filename"/></webappname>
|
<webappname><xsl:value-of select="$input.filename"/></webappname>
|
||||||
|
|||||||
Reference in New Issue
Block a user