diff --git a/asciidoctor-maven-commons/src/main/java/org/asciidoctor/maven/site/SiteConversionConfigurationParser.java b/asciidoctor-maven-commons/src/main/java/org/asciidoctor/maven/site/SiteConversionConfigurationParser.java index f6ae9e63..845fb261 100644 --- a/asciidoctor-maven-commons/src/main/java/org/asciidoctor/maven/site/SiteConversionConfigurationParser.java +++ b/asciidoctor-maven-commons/src/main/java/org/asciidoctor/maven/site/SiteConversionConfigurationParser.java @@ -1,6 +1,7 @@ package org.asciidoctor.maven.site; import org.apache.maven.project.MavenProject; +import org.asciidoctor.Attributes; import org.asciidoctor.AttributesBuilder; import org.asciidoctor.Options; import org.asciidoctor.OptionsBuilder; @@ -9,7 +10,10 @@ import org.codehaus.plexus.util.xml.Xpp3Dom; import java.io.File; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -29,17 +33,21 @@ public SiteConversionConfiguration processAsciiDocConfig(Xpp3Dom siteConfig, AsciidoctorHelper.addProperties(project.getProperties(), presetAttributes); - final Xpp3Dom siteConfiguration = Optional.ofNullable(siteConfig) - .map(sc -> sc.getChild("asciidoc")) - .orElse(null); + final Attributes attributes = presetAttributes.build(); - if (siteConfiguration == null) { - final OptionsBuilder options = presetOptions.attributes(presetAttributes.build()); - return new SiteConversionConfiguration(options.build(), Collections.emptyList()); + if (siteConfig == null) { + final Options options = presetOptions.attributes(attributes).build(); + return new SiteConversionConfiguration(options, Collections.emptyList()); + } + + final Xpp3Dom asciidocConfig = siteConfig.getChild("asciidoc"); + if (asciidocConfig == null) { + final Options options = presetOptions.attributes(attributes).build(); + return new SiteConversionConfiguration(options, Collections.emptyList()); } final List gemsToRequire = new ArrayList<>(); - for (Xpp3Dom asciidocOpt : siteConfiguration.getChildren()) { + for (Xpp3Dom asciidocOpt : asciidocConfig.getChildren()) { String optName = asciidocOpt.getName(); if ("requires".equals(optName)) { @@ -79,12 +87,12 @@ public SiteConversionConfiguration processAsciiDocConfig(Xpp3Dom siteConfig, } } - final Options options = presetOptions.attributes(presetAttributes.build()).build(); + final Options options = presetOptions.attributes(attributes).build(); return new SiteConversionConfiguration(options, gemsToRequire); } private File resolveProjectDir(MavenProject project, String path) { final File filePath = new File(path); - return !filePath.isAbsolute() ? new File(project.getBasedir(), filePath.toString()): filePath; + return !filePath.isAbsolute() ? new File(project.getBasedir(), filePath.toString()) : filePath; } } diff --git a/asciidoctor-maven-plugin/src/test/java/org/asciidoctor/maven/test/processors/ManpageInlineMacroProcessor.java b/asciidoctor-maven-plugin/src/test/java/org/asciidoctor/maven/test/processors/ManpageInlineMacroProcessor.java index 0600ffb3..951f9de7 100644 --- a/asciidoctor-maven-plugin/src/test/java/org/asciidoctor/maven/test/processors/ManpageInlineMacroProcessor.java +++ b/asciidoctor-maven-plugin/src/test/java/org/asciidoctor/maven/test/processors/ManpageInlineMacroProcessor.java @@ -14,7 +14,6 @@ public ManpageInlineMacroProcessor(String macroName) { @Override public String process(ContentNode parent, String target, Map attributes) { - final Map options = new HashMap<>(); options.put("type", ":link"); options.put("target", target + ".html"); diff --git a/pom.xml b/pom.xml index ff22ca30..34d38a8c 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ UTF-8 11 JavaSE-1.8 - 2.5.10 + 3.0.0-alpha.1 9.4.2.0 3.9.1 0.8.8