You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (JIRA)" <ji...@apache.org> on 2019/07/01 13:20:01 UTC

[jira] [Closed] (MSITE-842) $currentFileName and $alignedFileName are incorrect for Maven Report plugins that use several Sink instances

     [ https://issues.apache.org/jira/browse/MSITE-842?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Osipov closed MSITE-842.
--------------------------------
    Resolution: Fixed

Fixed with [42617d08423bedce0329162207172a07595e64ef|https://gitbox.apache.org/repos/asf?p=maven-site-plugin.git&a=commit&h=42617d08423bedce0329162207172a07595e64ef].

> $currentFileName and $alignedFileName are incorrect for Maven Report plugins that use several Sink instances
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: MSITE-842
>                 URL: https://issues.apache.org/jira/browse/MSITE-842
>             Project: Maven Site Plugin
>          Issue Type: Bug
>          Components: doxia integration
>            Reporter: Bertrand Martin
>            Assignee: Michael Osipov
>            Priority: Major
>             Fix For: 3.8.1
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> h1. Problem
> 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.
> h2. KmReference.java
> Maven Report plugin that use several instances of _Sink_
>  
> {code:java}
> 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);
>             }
> {code}
> h2. site.vm
> {code}
> alignedFileName = $alignedFileName
> currentFileName = $currentFileName
> getDoxiaSourcePath() = $docRenderingContext.getDoxiaSourcePath()
> getGenerator() = $docRenderingContext.getGenerator()
> getInputName() = $docRenderingContext.getInputName()
> getOutputName() = $docRenderingContext.getOutputName()
> getParserId() = $docRenderingContext.getParserId()
> getRelativePath() = $docRenderingContext.getRelativePath()
> {code}
> h2. Resulting another-page.html
> This file is *not* km_reference.html, and stil:
> {code}
> 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() = .
> {code}
> h1. Specification
> Modify _MultiPageSinkFactory.createSink( File outputDir, String outputName )_ so that it creates a new _RenderingContext_ for each sub-sink, with the proper document name.
> Note: _MultiPageSinkFactory_ is a private class in **org.apache.maven.plugins.site.render.ReportDocumentRenderer.java**
> Note: Make sure that the new document name (which will end up in *$currentFileName*) is calculated relative to the project site output directory, so that sub-sink objects can be in sub-directories.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)