diff --git a/src/main/java/org/wildfly/maven/plugins/quickstart/documentation/TOCGenerator.java b/src/main/java/org/wildfly/maven/plugins/quickstart/documentation/TOCGenerator.java index e3d398b..68ea921 100644 --- a/src/main/java/org/wildfly/maven/plugins/quickstart/documentation/TOCGenerator.java +++ b/src/main/java/org/wildfly/maven/plugins/quickstart/documentation/TOCGenerator.java @@ -21,28 +21,28 @@ public class TOCGenerator { public static void main(String[] args) throws IOException { Path root = Paths.get(".").normalize(); - new TOCGenerator(Arrays.asList("target", "dist", "template", "guide")).generate(root, "[TOC-quickstart]", Paths.get("README.adoc"), false); + new TOCGenerator(Arrays.asList("target", "dist", "template", "guide")).generate(root, "[TOC-quickstart]", Paths.get("README.adoc"), Paths.get("README.adoc"), false); } public TOCGenerator(List ignoredDirs) { this.ignoredDirs = ignoredDirs; } - public void generate(Path root, String tocMarker, Path targetDoc, boolean includeOpenshift) throws IOException { + public void generate(Path root, String tocMarker, Path sourceDoc, Path targetDoc, boolean includeOpenshift) throws IOException { Set allMetaData = new TreeSet<>(Comparator.comparing(MetaData::getName)); try (DirectoryStream dirs = Files.newDirectoryStream(root, entry -> Files.isDirectory(entry) && (!entry.getFileName().toString().startsWith(".")) && (!ignoredDirs.contains(entry.getFileName().toString()))) ) { dirs.forEach(path -> { - if (Files.exists(path.resolve("README.adoc"))){ + if (Files.exists(path.resolve(sourceDoc))){ try { allMetaData.add(MetaData.parseReadme(path)); } catch (IOException e) { e.printStackTrace(); } }else{ - System.out.println(String.format("Directory %s doesn't contain README.adoc, skipping", path)); + System.out.println(String.format("Directory %s doesn't contain source %s, skipping", path, sourceDoc)); } }); } diff --git a/src/main/java/org/wildfly/maven/plugins/quickstart/documentation/TOCMojo.java b/src/main/java/org/wildfly/maven/plugins/quickstart/documentation/TOCMojo.java index 6831197..7929870 100644 --- a/src/main/java/org/wildfly/maven/plugins/quickstart/documentation/TOCMojo.java +++ b/src/main/java/org/wildfly/maven/plugins/quickstart/documentation/TOCMojo.java @@ -36,6 +36,9 @@ public class TOCMojo extends AbstractMojo { @Parameter(defaultValue = "[TOC-quickstart]", required = true) protected String replaceMarker; + @Parameter(defaultValue = "target/docs/README-source.adoc", required = true) + protected String sourceDocument; + @Parameter(defaultValue = "target/docs/README.adoc", required = true) protected String targetDocument; @@ -49,7 +52,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { getLog().info("root directory: " + root); try { - generator.generate(root, replaceMarker, Paths.get(targetDocument), includeOpenshift); + generator.generate(root, replaceMarker, Paths.get(sourceDocument), Paths.get(targetDocument), includeOpenshift); } catch (IOException e) { throw new MojoFailureException("Could not generate TOC", e); }