I'm creating a Maven Skin (see https://maven.apache.org/doxia/doxia-sitetools/doxia-site-renderer/).
My site.vm needs to highlight links in a nav bar if the link is the current file being rendered.
I therefore need to know the name of the HTML file that site.vm is rendering.
The $currentFileName and $alignedFileName macros work just fine for regular documents (from Markdown source, for example). But for multi-pages documents, like a Maven Report plugin would generate, these macros keep returning the name of main page of the report, rather than the page being rendered.
How to retrieve the actual name of the file being rendered, and not just the name of the main HTML page of a Maven Report plugin?
I tried the following macros with no luck:
$alignedFileName
$currentFileName
$docRenderingContext.getInputName()
$docRenderingContext.getOutputName()
They all return the same value, which is the HTML filename of the main page of the Maven Report plugin.
KmReference.java (Maven Report plugin, creating several pages with getSinkFactory().createSink(outputDirectory, pageFilename)):
public class KmReference extends AbstractMavenReport {
public String getOutputName() {
return "km-reference";
}
…
@Override
protected void executeReport(Locale locale) throws MavenReportException {
…
// Create a new sink!
Sink kmSink;
try {
kmSink = getSinkFactory().createSink(outputDirectory, pageFilename);
} catch (IOException e) {
throw new MavenReportException("Could not create sink for " + pageFilename + " in " + outputDirectory.getAbsolutePath(), e);
}
site.vm (Velocity):
alignedFileName = $alignedFileName
currentFileName = $currentFileName
getDoxiaSourcePath() = $docRenderingContext.getDoxiaSourcePath()
getGenerator() = $docRenderingContext.getGenerator()
getInputName() = $docRenderingContext.getInputName()
getOutputName() = $docRenderingContext.getOutputName()
getParserId() = $docRenderingContext.getParserId()
getRelativePath() = $docRenderingContext.getRelativePath()
In all HTML files generated by my Maven Report plugin, I will get the exact same values:
another-page.html (not km-reference.html):
alignedFileName = km-reference.html
currentFileName = km-reference.html
getDoxiaSourcePath() = $docRenderingContext.getDoxiaSourcePath()
getGenerator() = com.sentrysoftware.maven:patrolreport-maven-plugin:2.0:km-reference
getInputName() = km-reference.html
getOutputName() = km-reference.html
getParserId() = $docRenderingContext.getParserId()
getRelativePath() = .
I would expect at least $alignedFileName to return the value another-page.html.
This issue (https://issues.apache.org/jira/browse/MSITE-842) has been solved with a PR provided by the OP.