Skip to content

Commit

Permalink
Make field names consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-o committed Oct 22, 2023
1 parent c0c35fb commit 79ed798
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,22 @@ public ReportDocumentRenderer(
}

private static class MultiPageSubSink extends SiteRendererSink {
private File outputDir;
private File outputDirectory;

private String outputName;

MultiPageSubSink(File outputDir, String outputName, DocumentRenderingContext docRenderingContext) {
MultiPageSubSink(File outputDirectory, String outputName, DocumentRenderingContext docRenderingContext) {
super(docRenderingContext);
this.outputName = outputName;
this.outputDir = outputDir;
this.outputDirectory = outputDirectory;
}

public String getOutputName() {
return outputName;
}

public File getOutputDir() {
return outputDir;
public File getOutputDirectory() {
return outputDirectory;
}
}

Expand All @@ -119,10 +119,10 @@ private static class MultiPageSinkFactory implements SinkFactory {
}

@Override
public Sink createSink(File outputDir, String outputName) {
public Sink createSink(File outputDirectory, String outputName) {
// Create a new document rendering context, similar to the main one, but with a different output name
String document = PathTool.getRelativeFilePath(
report.getReportOutputDirectory().getPath(), new File(outputDir, outputName).getPath());
report.getReportOutputDirectory().getPath(), new File(outputDirectory, outputName).getPath());
// Remove .html suffix since we know that we are in Site Renderer context
document = document.substring(0, document.lastIndexOf('.'));

Expand All @@ -136,7 +136,7 @@ public Sink createSink(File outputDir, String outputName) {
docRenderingContext.getGenerator());

// Create a sink for this subpage, based on this new document rendering context
MultiPageSubSink sink = new MultiPageSubSink(outputDir, outputName, subSinkContext);
MultiPageSubSink sink = new MultiPageSubSink(outputDirectory, outputName, subSinkContext);

// Add it to the list of sinks associated to this report
sinks.add(sink);
Expand Down Expand Up @@ -239,11 +239,11 @@ public void renderDocument(Writer writer, SiteRenderer siteRenderer, SiteRenderi
log.debug(" Rendering " + outputName);

// Create directories if necessary
if (!mySink.getOutputDir().exists()) {
mySink.getOutputDir().mkdirs();
if (!mySink.getOutputDirectory().exists()) {
mySink.getOutputDirectory().mkdirs();
}

File outputFile = new File(mySink.getOutputDir(), outputName);
File outputFile = new File(mySink.getOutputDirectory(), outputName);

try (Writer out = WriterFactory.newWriter(outputFile, siteRenderingContext.getOutputEncoding())) {
siteRenderer.mergeDocumentIntoSite(out, mySink, siteRenderingContext);
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,24 +142,24 @@ private void renderLocale(Locale locale, List<MavenReportExecution> reports, Lis
getLog().info("Validation is switched on, xml input documents will be validated!");
}

File outputDir = getOutputDirectory(locale);
File outputDirectory = getOutputDirectory(locale);

Map<String, DocumentRenderer> documents = locateDocuments(context, reports, locale);

// copy resources
siteRenderer.copyResources(context, outputDir);
siteRenderer.copyResources(context, outputDirectory);

// 1. render Doxia documents first
List<DocumentRenderer> nonDoxiaDocuments = renderDoxiaDocuments(documents, context, outputDir, false);
List<DocumentRenderer> nonDoxiaDocuments = renderDoxiaDocuments(documents, context, outputDirectory, false);

// prepare external reports
for (MavenReportExecution mavenReportExecution : reports) {
MavenReport report = mavenReportExecution.getMavenReport();
report.setReportOutputDirectory(outputDir);
report.setReportOutputDirectory(outputDirectory);
}

// 2. then non-Doxia documents (e.g., reports)
renderNonDoxiaDocuments(nonDoxiaDocuments, context, outputDir);
renderNonDoxiaDocuments(nonDoxiaDocuments, context, outputDirectory);

// 3. Generated docs must be (re-)done afterwards as they are often generated by reports
context.getSiteDirectories().clear();
Expand All @@ -172,10 +172,10 @@ private void renderLocale(Locale locale, List<MavenReportExecution> reports, Lis
Map<String, DocumentRenderer> generatedDocuments =
siteRenderer.locateDocumentFiles(context, false /* not editable */);

renderDoxiaDocuments(generatedDocuments, context, outputDir, true);
renderDoxiaDocuments(generatedDocuments, context, outputDirectory, true);

// copy generated resources also
siteRenderer.copyResources(context, outputDir);
siteRenderer.copyResources(context, outputDirectory);
}

/**
Expand All @@ -185,7 +185,7 @@ private void renderLocale(Locale locale, List<MavenReportExecution> reports, Lis
* @return the sublist of documents that are not Doxia source files
*/
private List<DocumentRenderer> renderDoxiaDocuments(
Map<String, DocumentRenderer> documents, SiteRenderingContext context, File outputDir, boolean generated)
Map<String, DocumentRenderer> documents, SiteRenderingContext context, File outputDirectory, boolean generated)
throws RendererException, IOException {
Map<String, DocumentRenderer> doxiaDocuments = new TreeMap<>();
List<DocumentRenderer> nonDoxiaDocuments = new ArrayList<>();
Expand Down Expand Up @@ -233,7 +233,7 @@ private List<DocumentRenderer> renderDoxiaDocuments(

getLog().info(mb.toString());

siteRenderer.render(doxiaDocuments.values(), context, outputDir);
siteRenderer.render(doxiaDocuments.values(), context, outputDirectory);
}

return nonDoxiaDocuments;
Expand All @@ -244,7 +244,7 @@ private List<DocumentRenderer> renderDoxiaDocuments(
*
* @param documents a collection of documents containing non-Doxia source files
*/
private void renderNonDoxiaDocuments(List<DocumentRenderer> documents, SiteRenderingContext context, File outputDir)
private void renderNonDoxiaDocuments(List<DocumentRenderer> documents, SiteRenderingContext context, File outputDirectory)
throws RendererException, IOException {
Map<String, Integer> counts = new TreeMap<>();

Expand Down Expand Up @@ -277,7 +277,7 @@ private void renderNonDoxiaDocuments(List<DocumentRenderer> documents, SiteRende
getLog().info(mb.toString());
}

siteRenderer.render(documents, context, outputDir);
siteRenderer.render(documents, context, outputDirectory);
}
}

Expand Down

0 comments on commit 79ed798

Please sign in to comment.