From 1fc2014438a08dace564d04afe1c10ee5ef73532 Mon Sep 17 00:00:00 2001 From: Abel Salgado Romero Date: Mon, 12 Feb 2024 00:22:15 +0100 Subject: [PATCH] (main) Port fixes for maven-site breadcrumbs from v2.2.x #763 (#774) * Add new HeaderParser and HeaderMetadata components to obtain Asciidoctor header details and inject them into the Sink header * Renames package `org.asciidoctor.maven.site.ast` to `org.asciidoctor.maven.site.parser` to match module name * Updated Integration Tests * Quick docs update (may require review after v3.0.0 release) --- CHANGELOG.adoc | 1 + .../src/it/maven-site-plugin/pom.xml | 2 +- .../src/site/asciidoc/file-with-toc.adoc | 2 + .../it/maven-site-plugin/src/site/site.xml | 6 +- .../src/it/maven-site-plugin/validate.groovy | 104 ++++++++++-- .../site/AsciidoctorConverterDoxiaParser.java | 56 +++--- .../maven/site/SiteConverterDecorator.java | 65 +++++++ .../site/SiteConverterDecoratorTest.java | 159 ++++++++++++++++++ asciidoctor-maven-commons/pom.xml | 9 +- .../asciidoctor/maven/site/HeadParser.java | 38 +++++ .../maven/site/HeaderMetadata.java | 57 +++++++ .../maven/site/HeadParserTest.java | 74 ++++++++ .../maven/site/HeaderMetadataTest.java | 152 +++++++++++++++++ .../src/it/maven-site-plugin/pom.xml | 2 +- .../src/site/asciidoc/sample.adoc | 2 + .../it/maven-site-plugin/src/site/site.xml | 11 +- .../src/it/maven-site-plugin/validate.groovy | 15 ++ .../AsciidoctorAstDoxiaParser.java | 12 +- .../AsciidoctorAstDoxiaParserModule.java | 2 +- .../site/{ast => parser}/NodeProcessor.java | 2 +- .../site/{ast => parser}/NodesSinker.java | 26 +-- .../processors/AbstractSinkNodeProcessor.java | 4 +- .../DescriptionListNodeProcessor.java | 4 +- .../processors/DocumentNodeProcessor.java | 4 +- .../processors/ImageNodeProcessor.java | 4 +- .../processors/ListItemNodeProcessor.java | 4 +- .../processors/ListingNodeProcessor.java | 4 +- .../processors/LiteralNodeProcessor.java | 4 +- .../processors/OrderedListNodeProcessor.java | 4 +- .../processors/ParagraphNodeProcessor.java | 4 +- .../processors/PreambleNodeProcessor.java | 4 +- .../processors/SectionNodeProcessor.java | 4 +- .../processors/TableNodeProcessor.java | 4 +- .../UnorderedListNodeProcessor.java | 4 +- .../AsciidoctorAstDoxiaParserTest.java | 10 +- .../site/{ast => parser}/NodeSinkerTest.java | 6 +- .../DescriptionListNodeProcessorTest.java | 26 +-- .../processors/DocumentNodeProcessorTest.java | 6 +- .../processors/ImageNodeProcessorTest.java | 6 +- .../processors/ListItemNodeProcessorTest.java | 6 +- .../processors/ListingNodeProcessorTest.java | 8 +- .../processors/LiteralNodeProcessorTest.java | 6 +- .../OrderedListNodeProcessorTest.java | 8 +- .../ParagraphNodeProcessorTest.java | 6 +- .../processors/PreambleNodeProcessorTest.java | 6 +- .../processors/SectionNodeProcessorTest.java | 6 +- .../processors/TableNodeProcessorTest.java | 18 +- .../UnorderedListNodeProcessorTest.java | 8 +- .../{ast => parser}/processors/test/Html.java | 2 +- .../test/JUnitNodeProcessorExtension.java | 10 +- .../processors/test/NodeProcessorTest.java | 4 +- .../processors/test/ReflectionUtils.java | 2 +- .../processors/test/StringTestUtils.java | 2 +- .../test/TestNodeProcessorFactory.java | 4 +- docs/modules/site-integration/nav.adoc | 3 +- .../pages/exposed-metadata.adoc | 17 ++ 56 files changed, 853 insertions(+), 166 deletions(-) create mode 100644 asciidoctor-converter-doxia-module/src/main/java/org/asciidoctor/maven/site/SiteConverterDecorator.java create mode 100644 asciidoctor-converter-doxia-module/src/test/java/org/asciidoctor/maven/site/SiteConverterDecoratorTest.java create mode 100644 asciidoctor-maven-commons/src/main/java/org/asciidoctor/maven/site/HeadParser.java create mode 100644 asciidoctor-maven-commons/src/main/java/org/asciidoctor/maven/site/HeaderMetadata.java create mode 100644 asciidoctor-maven-commons/src/test/java/org/asciidoctor/maven/site/HeadParserTest.java create mode 100644 asciidoctor-maven-commons/src/test/java/org/asciidoctor/maven/site/HeaderMetadataTest.java rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/AsciidoctorAstDoxiaParser.java (95%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/AsciidoctorAstDoxiaParserModule.java (96%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/NodeProcessor.java (95%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/NodesSinker.java (76%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/processors/AbstractSinkNodeProcessor.java (92%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/processors/DescriptionListNodeProcessor.java (95%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/processors/DocumentNodeProcessor.java (87%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/processors/ImageNodeProcessor.java (92%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/processors/ListItemNodeProcessor.java (95%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/processors/ListingNodeProcessor.java (96%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/processors/LiteralNodeProcessor.java (90%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/processors/OrderedListNodeProcessor.java (93%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/processors/ParagraphNodeProcessor.java (89%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/processors/PreambleNodeProcessor.java (86%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/processors/SectionNodeProcessor.java (96%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/processors/TableNodeProcessor.java (95%) rename asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/{ast => parser}/processors/UnorderedListNodeProcessor.java (92%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/AsciidoctorAstDoxiaParserTest.java (95%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/NodeSinkerTest.java (95%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/DescriptionListNodeProcessorTest.java (84%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/DocumentNodeProcessorTest.java (86%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/ImageNodeProcessorTest.java (92%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/ListItemNodeProcessorTest.java (94%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/ListingNodeProcessorTest.java (92%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/LiteralNodeProcessorTest.java (86%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/OrderedListNodeProcessorTest.java (91%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/ParagraphNodeProcessorTest.java (92%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/PreambleNodeProcessorTest.java (89%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/SectionNodeProcessorTest.java (96%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/TableNodeProcessorTest.java (88%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/UnorderedListNodeProcessorTest.java (91%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/test/Html.java (95%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/test/JUnitNodeProcessorExtension.java (83%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/test/NodeProcessorTest.java (78%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/test/ReflectionUtils.java (94%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/test/StringTestUtils.java (84%) rename asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/{ast => parser}/processors/test/TestNodeProcessorFactory.java (87%) create mode 100644 docs/modules/site-integration/pages/exposed-metadata.adoc diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index c43facf4..df03be08 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -18,6 +18,7 @@ Bug Fixes:: * Fix default value for eruby which caused a fail when using erb templates (#610) * Fix maven properties not being injected as attributes during site conversion (#656) * Remove Java 'requires open access' module warning in modern Java versions with JRuby v9.4.5.0 (#553) + * Fix breadcrumbs not showing the document title in maven-site pages (#763) Improvements:: diff --git a/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/pom.xml b/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/pom.xml index afad503e..df89a4b6 100644 --- a/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/pom.xml +++ b/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/pom.xml @@ -22,7 +22,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.1.2 + 3.4.5 diff --git a/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/src/site/asciidoc/file-with-toc.adoc b/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/src/site/asciidoc/file-with-toc.adoc index 061f8b7d..9b0f2bd4 100644 --- a/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/src/site/asciidoc/file-with-toc.adoc +++ b/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/src/site/asciidoc/file-with-toc.adoc @@ -1,4 +1,6 @@ = File with TOC +The Author +:docdatetime: 2024-02-07 23:36:29 :toc: [.lead] diff --git a/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/src/site/site.xml b/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/src/site/site.xml index e49c2d3d..71ea0778 100644 --- a/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/src/site/site.xml +++ b/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/src/site/site.xml @@ -1,5 +1,9 @@ + + + + @@ -10,6 +14,6 @@ org.apache.maven.skins maven-fluido-skin - 1.11.1 + 1.12.0 diff --git a/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/validate.groovy b/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/validate.groovy index 5d5e63d6..1e5fe5fc 100644 --- a/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/validate.groovy +++ b/asciidoctor-converter-doxia-module/src/it/maven-site-plugin/validate.groovy @@ -1,5 +1,4 @@ import java.nio.file.Files -import java.util.regex.Matcher import java.util.regex.Pattern File outputDir = new File(basedir, "target/site") @@ -12,44 +11,42 @@ final Pattern elementIdPattern = Pattern.compile(".* id=\"(.*?)\".*") def asserter = new FileAsserter() +def tocEntryCapturer = new PatternCapturer("
  • .*") +def elementIdCapturer = new PatternCapturer(".* id=\"(.*?)\".*") + for (String expectedFile : expectedFiles) { final File file = new File(outputDir, expectedFile) - println "Checking for presence of $file" + println "Checking for presence of $file" asserter.isNotEmpty(file) if (expectedFile == "file-with-toc.html") { List lines = Files.readAllLines(file.toPath()) println "Ensuring IDs match TOC links" - List tocEntries = new ArrayList() + // == Assert TOC == for (String line : lines) { - Matcher matcher = tocEntry.matcher(line) - if (matcher.matches()) { - tocEntries.add(matcher.group(1)) - } + tocEntryCapturer.tryMatches(line) - matcher = elementIdPattern.matcher(line) - if (matcher.matches()) { - String elementId = matcher.group(1) - if (tocEntries.contains(elementId)) { - tocEntries.remove(tocEntries.indexOf(elementId)) - } + String match = elementIdCapturer.tryMatches(line) + if (match != null) { + tocEntryCapturer.remove(match) } } - if (tocEntries.size() != 0) { - throw new Exception("Couldn't find matching IDs for the following TOC entries: $tocEntries") + if (tocEntryCapturer.size() != 0) { + throw new Exception("Couldn't find matching IDs for the following TOC entries: ${tocEntryCapturer.getHits()}") } boolean includeResolved = false boolean sourceHighlighted = false + // == Assert includes == for (String line : lines) { if (!includeResolved && line.contains("Content included from the file ")) { includeResolved = true } else if (!sourceHighlighted && line.contains("<plugin>")) { - sourceHighlighted = true + sourceHighlighted = true; } } @@ -72,6 +69,46 @@ for (String expectedFile : expectedFiles) { if (!foundReplacement) { throw new Exception("Maven properties not replaced.") } + + // == Assert header metadata == + def metaPattern = Pattern.compile("") + boolean headFound = false + Map metaTags = new HashMap<>() + + for (String line : lines) { + if (!headFound) { + headFound = line.endsWith("") + continue + } + if (line.endsWith("")) break + def matcher = metaPattern.matcher(line.trim()) + if (matcher.matches()) { + metaTags.put(matcher.group(1), matcher.group(2)) + } + } + + if (metaTags['author'] != 'The Author') + throw new RuntimeException("Author not found in $metaTags") + if (metaTags['date'] != '2024-02-07 23:36:29') + throw new RuntimeException("docdatetime not found in: $metaTags") + + // assert breadcrumbs + boolean breadcrumbTagFound = false + boolean breadcrumbFound = false + final String docTitle = "File with TOC" + + for (String line : lines) { + if (!breadcrumbTagFound) { + breadcrumbTagFound = line.endsWith("
    ") + continue + } + println "Testing: ${line.trim()}" + breadcrumbFound = line.trim().endsWith("${docTitle}
  • ") + if (breadcrumbFound) break + } + + if (!breadcrumbFound) + throw new RuntimeException("No breadcrumb found: expected title: $docTitle") } } @@ -95,4 +132,39 @@ class FileAsserter { } } +class PatternCapturer { + + private final Pattern pattern + private final List hits + + PatternCapturer(String pattern) { + this.pattern = Pattern.compile(pattern) + this.hits = new ArrayList() + } + + + String tryMatches(String text) { + def matcher = pattern.matcher(text) + if (matcher.matches()) { + def group = matcher.group(1) + hits.add(group) + return group + } + return null + } + + void remove(String text) { + hits.remove(text) + } + + int size() { + return hits.size() + } + + List getHits() { + return hits + } +} + + return true diff --git a/asciidoctor-converter-doxia-module/src/main/java/org/asciidoctor/maven/site/AsciidoctorConverterDoxiaParser.java b/asciidoctor-converter-doxia-module/src/main/java/org/asciidoctor/maven/site/AsciidoctorConverterDoxiaParser.java index 98b301e3..d2f8af37 100644 --- a/asciidoctor-converter-doxia-module/src/main/java/org/asciidoctor/maven/site/AsciidoctorConverterDoxiaParser.java +++ b/asciidoctor-converter-doxia-module/src/main/java/org/asciidoctor/maven/site/AsciidoctorConverterDoxiaParser.java @@ -1,26 +1,30 @@ package org.asciidoctor.maven.site; +import javax.inject.Inject; +import javax.inject.Provider; +import java.io.File; +import java.io.IOException; +import java.io.Reader; +import java.util.logging.Logger; + import org.apache.maven.doxia.parser.AbstractTextParser; import org.apache.maven.doxia.parser.ParseException; import org.apache.maven.doxia.parser.Parser; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.project.MavenProject; -import org.asciidoctor.*; +import org.asciidoctor.Asciidoctor; +import org.asciidoctor.AttributesBuilder; +import org.asciidoctor.OptionsBuilder; +import org.asciidoctor.SafeMode; import org.asciidoctor.maven.log.LogHandler; import org.asciidoctor.maven.log.LogRecordFormatter; import org.asciidoctor.maven.log.LogRecordsProcessors; import org.asciidoctor.maven.log.MemoryLogHandler; +import org.asciidoctor.maven.site.SiteConverterDecorator.Result; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.xml.Xpp3Dom; -import javax.inject.Inject; -import javax.inject.Provider; -import java.io.File; -import java.io.IOException; -import java.io.Reader; -import java.util.logging.Logger; - /** * This class is used by the Doxia framework * to handle the actual parsing of the AsciiDoc input files into HTML to be consumed/wrapped @@ -67,7 +71,7 @@ public void parse(Reader reader, Sink sink, String reference) throws ParseExcept final Asciidoctor asciidoctor = Asciidoctor.Factory.create(); SiteConversionConfiguration conversionConfig = new SiteConversionConfigurationParser(project) - .processAsciiDocConfig(siteConfig, defaultOptions(siteDirectory), defaultAttributes()); + .processAsciiDocConfig(siteConfig, defaultOptions(siteDirectory), defaultAttributes()); for (String require : conversionConfig.getRequires()) { requireLibrary(asciidoctor, require); } @@ -75,23 +79,28 @@ public void parse(Reader reader, Sink sink, String reference) throws ParseExcept final LogHandler logHandler = getLogHandlerConfig(siteConfig); final MemoryLogHandler memoryLogHandler = asciidoctorLoggingSetup(asciidoctor, logHandler, siteDirectory); - // QUESTION should we keep OptionsBuilder & AttributesBuilder separate for call to convertAsciiDoc? - String asciidocHtml = convertAsciiDoc(asciidoctor, source, conversionConfig.getOptions()); + final SiteConverterDecorator siteConverter = new SiteConverterDecorator(asciidoctor); + final Result headerMetadata = siteConverter.process(source, conversionConfig.getOptions()); + try { // process log messages according to mojo configuration new LogRecordsProcessors(logHandler, siteDirectory, errorMessage -> getLog().error(errorMessage)) - .processLogRecords(memoryLogHandler); + .processLogRecords(memoryLogHandler); } catch (Exception exception) { throw new ParseException(exception.getMessage(), exception); } - sink.rawText(asciidocHtml); + new HeadParser(sink) + .parse(headerMetadata.getHeaderMetadata()); + + sink.rawText(headerMetadata.getHtml()); } + private MemoryLogHandler asciidoctorLoggingSetup(Asciidoctor asciidoctor, LogHandler logHandler, File siteDirectory) { final MemoryLogHandler memoryLogHandler = new MemoryLogHandler(logHandler.getOutputToConsole(), - logRecord -> getLog().info(LogRecordFormatter.format(logRecord, siteDirectory))); + logRecord -> getLog().info(LogRecordFormatter.format(logRecord, siteDirectory))); asciidoctor.registerLogHandler(memoryLogHandler); // disable default console output of AsciidoctorJ Logger.getLogger("asciidoctor").setUseParentHandlers(false); @@ -119,16 +128,16 @@ protected File resolveSiteDirectory(MavenProject project, Xpp3Dom siteConfig) { } protected OptionsBuilder defaultOptions(File siteDirectory) { - return Options.builder() - .backend("xhtml") - .safe(SafeMode.UNSAFE) - .baseDir(new File(siteDirectory, ROLE_HINT)); + return OptionsBuilder.options() + .backend("xhtml") + .safe(SafeMode.UNSAFE) + .baseDir(new File(siteDirectory, ROLE_HINT)); } protected AttributesBuilder defaultAttributes() { - return Attributes.builder() - .attribute("idprefix", "@") - .attribute("showtitle", "@"); + return AttributesBuilder.attributes() + .attribute("idprefix", "@") + .attribute("showtitle", "@"); } private void requireLibrary(Asciidoctor asciidoctor, String require) { @@ -140,9 +149,4 @@ private void requireLibrary(Asciidoctor asciidoctor, String require) { } } } - - protected String convertAsciiDoc(Asciidoctor asciidoctor, String source, Options options) { - return asciidoctor.convert(source, options); - } - } diff --git a/asciidoctor-converter-doxia-module/src/main/java/org/asciidoctor/maven/site/SiteConverterDecorator.java b/asciidoctor-converter-doxia-module/src/main/java/org/asciidoctor/maven/site/SiteConverterDecorator.java new file mode 100644 index 00000000..8fecdaae --- /dev/null +++ b/asciidoctor-converter-doxia-module/src/main/java/org/asciidoctor/maven/site/SiteConverterDecorator.java @@ -0,0 +1,65 @@ +package org.asciidoctor.maven.site; + +import java.util.Map; + +import org.asciidoctor.Asciidoctor; +import org.asciidoctor.Options; +import org.asciidoctor.OptionsBuilder; +import org.asciidoctor.ast.Document; + +/** + * Asciidoctor conversion wrapper for maven-site integration. + * In addition to conversion, handles header metadata extraction. + */ +class SiteConverterDecorator { + + private final Asciidoctor asciidoctor; + + SiteConverterDecorator(Asciidoctor asciidoctor) { + this.asciidoctor = asciidoctor; + } + + Result process(String content, Options options) { + final Document document = asciidoctor.load(content, headerProcessingMetadata(options)); + final HeaderMetadata headerMetadata = HeaderMetadata.from(document); + + final String html = asciidoctor.convert(content, options); + + return new Result(headerMetadata, html); + } + + private static Options headerProcessingMetadata(Options options) { + Map optionsMap = options.map(); + OptionsBuilder builder = Options.builder(); + for (Map.Entry entry : optionsMap.entrySet()) { + builder.option(entry.getKey(), entry.getValue()); + } + + builder.parseHeaderOnly(Boolean.TRUE); + return builder.build(); + } + + /** + * Simple tuple to return Asciidoctor extracted metadata and conversion result. + */ + final class Result { + + private final HeaderMetadata headerMetadata; + private final String html; + + Result(HeaderMetadata headerMetadata, String html) { + this.headerMetadata = headerMetadata; + this.html = html; + } + + HeaderMetadata getHeaderMetadata() { + return headerMetadata; + } + + String getHtml() { + return html; + } + } + + +} diff --git a/asciidoctor-converter-doxia-module/src/test/java/org/asciidoctor/maven/site/SiteConverterDecoratorTest.java b/asciidoctor-converter-doxia-module/src/test/java/org/asciidoctor/maven/site/SiteConverterDecoratorTest.java new file mode 100644 index 00000000..db098b8e --- /dev/null +++ b/asciidoctor-converter-doxia-module/src/test/java/org/asciidoctor/maven/site/SiteConverterDecoratorTest.java @@ -0,0 +1,159 @@ +package org.asciidoctor.maven.site; + +import java.util.Collections; +import java.util.Map; +import java.util.stream.Stream; + +import org.asciidoctor.Asciidoctor; +import org.asciidoctor.Attributes; +import org.asciidoctor.Options; +import org.asciidoctor.SafeMode; +import org.asciidoctor.maven.site.SiteConverterDecorator.Result; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; + +import static org.assertj.core.api.Assertions.assertThat; + +class SiteConverterDecoratorTest { + + private final Asciidoctor asciidoctor = Asciidoctor.Factory.create(); + + @ParameterizedTest + @ValueSource(strings = { + "= Hello, AsciiDoc!", + "# Hello, AsciiDoc!", + "Hello, AsciiDoc!\n================" + }) + void should_extract_title_from_header(String title) { + SiteConverterDecorator siteConverter = new SiteConverterDecorator(asciidoctor); + + Options options = defaultOptions(); + Result result = siteConverter.process(title + "\n", options); + + HeaderMetadata headerMetadata = result.getHeaderMetadata(); + assertThat(headerMetadata.getTitle()).isEqualTo("Hello, AsciiDoc!"); + assertThat(result.getHtml()).isNotBlank(); + } + + @Test + void should_extract_title_from_attribute() { + SiteConverterDecorator siteConverter = new SiteConverterDecorator(asciidoctor); + + Options options = Options.builder() + .safe(SafeMode.UNSAFE) + .backend("xhtml") + .attributes(Attributes.builder() + .attribute("idprefix", "@") + .attribute("showtitle", "@") + .attribute("who", "me") + .build()) + .build(); + Result result = siteConverter.process("= Hello, {who}!\n", options); + + HeaderMetadata headerMetadata = result.getHeaderMetadata(); + assertThat(headerMetadata.getTitle()).isEqualTo("Hello, me!"); + assertThat(result.getHtml()).isNotBlank(); + } + + + @ParameterizedTest + @MethodSource("authorsProvider") + void should_extract_author(String content, String expected) { + SiteConverterDecorator siteConverter = new SiteConverterDecorator(asciidoctor); + + Options options = defaultOptions(); + Result result = siteConverter.process(content + "\n", options); + + HeaderMetadata headerMetadata = result.getHeaderMetadata(); + assertThat(headerMetadata.getAuthors()) + .containsExactly(expected); + assertThat(result.getHtml()).isNotBlank(); + } + + private static Stream authorsProvider() { + return Stream.of( + Arguments.of("= Title\nAuthor YesMe", "Author YesMe"), + Arguments.of("= Title\nAuthor Romero_Encinas", "Author Romero Encinas"), + Arguments.of("= Title\n:author: Author Romero_Encinas", "Author Romero Encinas"), + Arguments.of("= Title\nAuthor_Me ", "Author Me ") + ); + } + + @Test + void should_extract_author_from_attribute() { + SiteConverterDecorator siteConverter = new SiteConverterDecorator(asciidoctor); + + String content = "= Hello, AsciiDoc!"; + Options options = optionsWithAttributes(Collections.singletonMap("author", "From Attr")); + Result result = siteConverter.process(content + "\n", options); + + HeaderMetadata headerMetadata = result.getHeaderMetadata(); + assertThat(headerMetadata.getAuthors()) + .containsExactly("From Attr"); + assertThat(result.getHtml()).isNotBlank(); + } + + @Test + void should_extract_multiple_authors() { + SiteConverterDecorator siteConverter = new SiteConverterDecorator(asciidoctor); + + String content = "= Hello, AsciiDoc!\nfirstname1 lastname2; firstname3 middlename4 lastname5"; + Result result = siteConverter.process(content + "\n", defaultOptions()); + + HeaderMetadata headerMetadata = result.getHeaderMetadata(); + assertThat(headerMetadata.getAuthors()) + .containsExactlyInAnyOrder("firstname1 lastname2", "firstname3 middlename4 lastname5"); + assertThat(result.getHtml()).isNotBlank(); + } + + @Test + void should_extract_datetime_generated() { + SiteConverterDecorator siteConverter = new SiteConverterDecorator(asciidoctor); + + String content = "= Hello, AsciiDoc!"; + Result result = siteConverter.process(content + "\n", defaultOptions()); + + HeaderMetadata headerMetadata = result.getHeaderMetadata(); + assertThat(headerMetadata.getDateTime()).matches("(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2}) .*"); + assertThat(result.getHtml()).isNotBlank(); + } + + @Test + void should_extract_datetime_from_attribute() { + SiteConverterDecorator siteConverter = new SiteConverterDecorator(asciidoctor); + + String content = "= Hello, AsciiDoc!"; + Options options = optionsWithAttributes(Collections.singletonMap("docdatetime", "2024-11-22")); + Result result = siteConverter.process(content + "\n", options); + + HeaderMetadata headerMetadata = result.getHeaderMetadata(); + assertThat(headerMetadata.getDateTime()).isEqualTo("2024-11-22"); + assertThat(result.getHtml()).isNotBlank(); + } + + private Options defaultOptions() { + return Options.builder() + .safe(SafeMode.UNSAFE) + .backend("xhtml") + .attributes(defaultAttributes()) + .build(); + } + + private static Attributes defaultAttributes() { + return Attributes.builder() + .attribute("idprefix", "@") + .attribute("showtitle", "@") + .build(); + } + + private Options optionsWithAttributes(Map attributes) { + Options options = defaultOptions(); + Attributes attr = defaultAttributes(); + attributes.forEach((k, v) -> attr.setAttribute(k, v)); + options.setAttributes(attr); + return options; + } +} diff --git a/asciidoctor-maven-commons/pom.xml b/asciidoctor-maven-commons/pom.xml index 69f45559..5418f5c3 100644 --- a/asciidoctor-maven-commons/pom.xml +++ b/asciidoctor-maven-commons/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 @@ -39,6 +40,12 @@ 3.5.1 compile + + org.apache.maven.doxia + doxia-sink-api + 1.12.0 + provided + diff --git a/asciidoctor-maven-commons/src/main/java/org/asciidoctor/maven/site/HeadParser.java b/asciidoctor-maven-commons/src/main/java/org/asciidoctor/maven/site/HeadParser.java new file mode 100644 index 00000000..cdbce1da --- /dev/null +++ b/asciidoctor-maven-commons/src/main/java/org/asciidoctor/maven/site/HeadParser.java @@ -0,0 +1,38 @@ +package org.asciidoctor.maven.site; + +import java.util.Optional; + +import org.apache.maven.doxia.sink.Sink; + +/** + * Injects Asciidoctor header information into Doxia's {@link Sink}. + * This allows Doxia to build: + * - breadcrumbs + * - HTML head's meta elements + */ +public class HeadParser { + + private final Sink sink; + + public HeadParser(Sink sink) { + this.sink = sink; + } + + public void parse(HeaderMetadata headerMetadata) { + sink.head(); + sink.title(); + sink.text(Optional.ofNullable(headerMetadata.getTitle()).orElse("[Untitled]")); + sink.title_(); + + for (String author : headerMetadata.getAuthors()) { + sink.author(); + sink.text(author.toString()); + sink.author_(); + } + + sink.date(); + sink.text(headerMetadata.getDateTime()); + sink.date_(); + sink.head_(); + } +} diff --git a/asciidoctor-maven-commons/src/main/java/org/asciidoctor/maven/site/HeaderMetadata.java b/asciidoctor-maven-commons/src/main/java/org/asciidoctor/maven/site/HeaderMetadata.java new file mode 100644 index 00000000..092f6dec --- /dev/null +++ b/asciidoctor-maven-commons/src/main/java/org/asciidoctor/maven/site/HeaderMetadata.java @@ -0,0 +1,57 @@ +package org.asciidoctor.maven.site; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +import org.asciidoctor.ast.Author; +import org.asciidoctor.ast.Document; +import org.asciidoctor.ast.RevisionInfo; + +/** + * Extract required metadata from Asciidoctor to be used for maven-site pages. + */ +public class HeaderMetadata { + + private final String title; + private final List authors; + private final String dateTime; + + HeaderMetadata(String title, List authors, String dateTime) { + this.title = title; + this.authors = authors; + this.dateTime = dateTime; + } + + String getTitle() { + return title; + } + + List getAuthors() { + return authors; + } + + String getDateTime() { + return dateTime; + } + + public static HeaderMetadata from(Document document) { + final String title = document.getTitle(); + final List authors = extractAuthors(document); + final String documentDateTime = extractDocumentDateTime(document, document.getAttributes()); + return new HeaderMetadata(title, authors, documentDateTime); + } + + private static List extractAuthors(Document document) { + return document.getAuthors().stream() + .map(Author::toString) + .collect(Collectors.toList()); + } + + private static String extractDocumentDateTime(Document document, Map attributes) { + final RevisionInfo revisionInfo = document.getRevisionInfo(); + return Optional.ofNullable(revisionInfo.getDate()) + .orElse((String) attributes.get("docdatetime")); + } +} diff --git a/asciidoctor-maven-commons/src/test/java/org/asciidoctor/maven/site/HeadParserTest.java b/asciidoctor-maven-commons/src/test/java/org/asciidoctor/maven/site/HeadParserTest.java new file mode 100644 index 00000000..ce856b3a --- /dev/null +++ b/asciidoctor-maven-commons/src/test/java/org/asciidoctor/maven/site/HeadParserTest.java @@ -0,0 +1,74 @@ +package org.asciidoctor.maven.site; + +import org.apache.maven.doxia.sink.Sink; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +import java.util.List; + +import static org.mockito.Mockito.times; + +class HeadParserTest { + + @Test + void should_inject_title() { + final Sink sinkSpy = Mockito.spy(Sink.class); + + var headerMetadata = new HeaderMetadata("test title", List.of(), null); + new HeadParser(sinkSpy).parse(headerMetadata); + + Mockito.verify(sinkSpy).head(); + Mockito.verify(sinkSpy).head_(); + + Mockito.verify(sinkSpy).title(); + Mockito.verify(sinkSpy).text("test title"); + Mockito.verify(sinkSpy).title_(); + + Mockito.verify(sinkSpy, times(0)).author(); + Mockito.verify(sinkSpy, times(1)).date(); + } + + @Test + void should_inject_author() { + final Sink sinkSpy = Mockito.spy(Sink.class); + + var headerMetadata = new HeaderMetadata(null, List.of("an author"), null); + new HeadParser(sinkSpy).parse(headerMetadata); + + Mockito.verify(sinkSpy).head(); + Mockito.verify(sinkSpy).head_(); + + verifyDefaultTitle(sinkSpy); + + Mockito.verify(sinkSpy).author(); + Mockito.verify(sinkSpy).text("an author"); + Mockito.verify(sinkSpy).author(); + + Mockito.verify(sinkSpy, times(1)).date(); + } + + @Test + void should_inject_date() { + final Sink sinkSpy = Mockito.spy(Sink.class); + + var headerMetadata = new HeaderMetadata(null, List.of(), "2024-11-22"); + new HeadParser(sinkSpy).parse(headerMetadata); + + Mockito.verify(sinkSpy).head(); + Mockito.verify(sinkSpy).head_(); + + verifyDefaultTitle(sinkSpy); + + Mockito.verify(sinkSpy, times(0)).author(); + + Mockito.verify(sinkSpy).date(); + Mockito.verify(sinkSpy).text("2024-11-22"); + Mockito.verify(sinkSpy).date_(); + } + + private void verifyDefaultTitle(Sink sinkSpy) { + Mockito.verify(sinkSpy).title(); + Mockito.verify(sinkSpy).text("[Untitled]"); + Mockito.verify(sinkSpy).title_(); + } +} diff --git a/asciidoctor-maven-commons/src/test/java/org/asciidoctor/maven/site/HeaderMetadataTest.java b/asciidoctor-maven-commons/src/test/java/org/asciidoctor/maven/site/HeaderMetadataTest.java new file mode 100644 index 00000000..0e243a2f --- /dev/null +++ b/asciidoctor-maven-commons/src/test/java/org/asciidoctor/maven/site/HeaderMetadataTest.java @@ -0,0 +1,152 @@ +package org.asciidoctor.maven.site; + +import java.util.Collections; +import java.util.Map; +import java.util.stream.Stream; + +import org.asciidoctor.Asciidoctor; +import org.asciidoctor.Attributes; +import org.asciidoctor.Options; +import org.asciidoctor.SafeMode; +import org.asciidoctor.ast.Document; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; + +import static org.assertj.core.api.Assertions.assertThat; + +class HeaderMetadataTest { + + private final Asciidoctor asciidoctor = Asciidoctor.Factory.create(); + + @ParameterizedTest + @ValueSource(strings = { + "= Hello, AsciiDoc!", + "# Hello, AsciiDoc!", + "Hello, AsciiDoc!\n================" + }) + void should_extract_title_from_header(String content) { + Document document = document(content); + + final var headerMetadata = HeaderMetadata.from(document); + + assertThat(headerMetadata.getTitle()).isEqualTo("Hello, AsciiDoc!"); + } + + @Test + void should_extract_title_from_attribute() { + Options options = Options.builder() + .safe(SafeMode.UNSAFE) + .backend("xhtml") + .attributes(Attributes.builder() + .attribute("idprefix", "@") + .attribute("showtitle", "@") + .attribute("who", "me") + .build()) + .build(); + Document document = document("= Hello, {who}!\n", options); + + final var headerMetadata = HeaderMetadata.from(document); + + assertThat(headerMetadata.getTitle()).isEqualTo("Hello, me!"); + } + + + @ParameterizedTest + @MethodSource("authorsProvider") + void should_extract_author(String content, String expected) { + Document document = document(content + "\n", defaultOptions()); + + final var headerMetadata = HeaderMetadata.from(document); + + assertThat(headerMetadata.getAuthors()) + .containsExactly(expected); + } + + private static Stream authorsProvider() { + return Stream.of( + Arguments.of("= Title\nAuthor YesMe", "Author YesMe"), + Arguments.of("= Title\nAuthor Romero_Encinas", "Author Romero Encinas"), + Arguments.of("= Title\n:author: Author Romero_Encinas", "Author Romero Encinas"), + Arguments.of("= Title\nAuthor_Me ", "Author Me ") + ); + } + + @Test + void should_extract_author_from_attribute() { + String content = "= Hello, AsciiDoc!"; + Options options = optionsWithAttributes(Collections.singletonMap("author", "From Attr")); + Document document = document(content + "\n", options); + + final var headerMetadata = HeaderMetadata.from(document); + + assertThat(headerMetadata.getAuthors()) + .containsExactly("From Attr"); + } + + @Test + void should_extract_multiple_authors() { + String content = "= Hello, AsciiDoc!\nfirstname1 lastname2; firstname3 middlename4 lastname5"; + Document document = document(content + "\n", defaultOptions()); + + final var headerMetadata = HeaderMetadata.from(document); + + assertThat(headerMetadata.getAuthors()) + .containsExactlyInAnyOrder("firstname1 lastname2", "firstname3 middlename4 lastname5"); + } + + @Test + void should_extract_datetime_generated() { + String content = "= Hello, AsciiDoc!"; + Document document = document(content + "\n", defaultOptions()); + + final var headerMetadata = HeaderMetadata.from(document); + + assertThat(headerMetadata.getDateTime()).matches("(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2}) .*"); + } + + @Test + void should_extract_datetime_from_attribute() { + String content = "= Hello, AsciiDoc!"; + Options options = optionsWithAttributes(Collections.singletonMap("docdatetime", "2024-11-22")); + Document document = document(content + "\n", options); + + final var headerMetadata = HeaderMetadata.from(document); + + assertThat(headerMetadata.getDateTime()).isEqualTo("2024-11-22"); + } + + private Document document(String content) { + return asciidoctor.load(content, defaultOptions()); + } + + private Document document(String content, Options options) { + return asciidoctor.load(content, options); + } + + private Options defaultOptions() { + return Options.builder() + .safe(SafeMode.UNSAFE) + .backend("xhtml") + .parseHeaderOnly(Boolean.TRUE) + .attributes(defaultAttributes()) + .build(); + } + + private static Attributes defaultAttributes() { + return Attributes.builder() + .attribute("idprefix", "@") + .attribute("showtitle", "@") + .build(); + } + + private Options optionsWithAttributes(Map attributes) { + Options options = defaultOptions(); + Attributes attr = defaultAttributes(); + attributes.forEach((k, v) -> attr.setAttribute(k, v)); + options.setAttributes(attr); + return options; + } +} diff --git a/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/pom.xml b/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/pom.xml index 786fa89b..2ab11cb7 100644 --- a/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/pom.xml +++ b/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/pom.xml @@ -17,7 +17,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.1.2 + 3.4.5 diff --git a/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/src/site/asciidoc/sample.adoc b/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/src/site/asciidoc/sample.adoc index 364d2c9d..8d18df98 100644 --- a/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/src/site/asciidoc/sample.adoc +++ b/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/src/site/asciidoc/sample.adoc @@ -1,4 +1,6 @@ = Sample +The Author +:docdatetime: 2024-02-07 23:36:29 This is an example `.adoc` file that was processed by the Doxia Parser module in the Asciidoctor Maven Plugin. Version {docs-version}. diff --git a/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/src/site/site.xml b/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/src/site/site.xml index 08a5002b..9ae5a719 100644 --- a/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/src/site/site.xml +++ b/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/src/site/site.xml @@ -1,8 +1,17 @@ + + + + - ${reports} + ${reports} + + org.apache.maven.skins + maven-fluido-skin + 1.12.0 + diff --git a/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/validate.groovy b/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/validate.groovy index 49cbe17b..096af4c7 100644 --- a/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/validate.groovy +++ b/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/validate.groovy @@ -12,6 +12,11 @@ new FileAsserter().isNotEmpty(file) String htmlContent = file.text new HtmlAsserter(htmlContent).with { asserter -> + asserter.containsMetadata("author", "The Author") + asserter.containsMetadata("date", "2024-02-07 23:36:29") + + asserter.containsBreadcrumbs("Sample") + asserter.containsDocumentTitle("Sample") asserter.containsPreambleStartingWith("This is an example") asserter.containsSectionTitle("First section", 2) @@ -125,6 +130,16 @@ class HtmlAsserter { assertFound("HTML text", text, found) } + void containsMetadata(String name, String value) { + def found = find("") + assertFound("head/meta", value, found) + } + + void containsBreadcrumbs(String value) { + def found = find("
  • ${value}
  • ") + assertFound("Breadcrumb", value, found) + } + void containsDocumentTitle(String value) { def found = find("

    $value

    ") assertFound("Document Title", value, found) diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/AsciidoctorAstDoxiaParser.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/AsciidoctorAstDoxiaParser.java similarity index 95% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/AsciidoctorAstDoxiaParser.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/AsciidoctorAstDoxiaParser.java index 542a58bf..ebe72db0 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/AsciidoctorAstDoxiaParser.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/AsciidoctorAstDoxiaParser.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast; +package org.asciidoctor.maven.site.parser; import javax.inject.Inject; import javax.inject.Provider; @@ -23,6 +23,8 @@ import org.asciidoctor.maven.log.LogRecordFormatter; import org.asciidoctor.maven.log.LogRecordsProcessors; import org.asciidoctor.maven.log.MemoryLogHandler; +import org.asciidoctor.maven.site.HeaderMetadata; +import org.asciidoctor.maven.site.HeadParser; import org.asciidoctor.maven.site.SiteConversionConfiguration; import org.asciidoctor.maven.site.SiteConversionConfigurationParser; import org.asciidoctor.maven.site.SiteLogHandlerDeserializer; @@ -85,7 +87,6 @@ public void parse(Reader reader, Sink sink, String reference) throws ParseExcept final LogHandler logHandler = getLogHandlerConfig(siteConfig); final MemoryLogHandler memoryLogHandler = asciidoctorLoggingSetup(asciidoctor, logHandler, siteDirectory); - sink.body(); if (isNotBlank(reference)) getLog().debug("Document loaded: " + reference); @@ -100,6 +101,13 @@ public void parse(Reader reader, Sink sink, String reference) throws ParseExcept throw new ParseException(exception.getMessage(), exception); } + + HeaderMetadata headerMetadata = HeaderMetadata.from(document); + + new HeadParser(sink) + .parse(headerMetadata); + + sink.body(); final NodesSinker nodesSinker = new NodesSinker(sink); nodesSinker.processNode(document); sink.body_(); diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/AsciidoctorAstDoxiaParserModule.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/AsciidoctorAstDoxiaParserModule.java similarity index 96% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/AsciidoctorAstDoxiaParserModule.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/AsciidoctorAstDoxiaParserModule.java index 9c92e415..0ecd381d 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/AsciidoctorAstDoxiaParserModule.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/AsciidoctorAstDoxiaParserModule.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast; +package org.asciidoctor.maven.site.parser; import org.apache.maven.doxia.parser.module.AbstractParserModule; import org.apache.maven.doxia.parser.module.ParserModule; diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/NodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/NodeProcessor.java similarity index 95% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/NodeProcessor.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/NodeProcessor.java index 69a08a8d..086d3feb 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/NodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/NodeProcessor.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast; +package org.asciidoctor.maven.site.parser; import org.asciidoctor.ast.StructuralNode; diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/NodesSinker.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/NodesSinker.java similarity index 76% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/NodesSinker.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/NodesSinker.java index 31db76a1..85dab98a 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/NodesSinker.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/NodesSinker.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast; +package org.asciidoctor.maven.site.parser; import java.util.Arrays; import java.util.List; @@ -6,18 +6,18 @@ import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.processors.DescriptionListNodeProcessor; -import org.asciidoctor.maven.site.ast.processors.DocumentNodeProcessor; -import org.asciidoctor.maven.site.ast.processors.ImageNodeProcessor; -import org.asciidoctor.maven.site.ast.processors.ListItemNodeProcessor; -import org.asciidoctor.maven.site.ast.processors.ListingNodeProcessor; -import org.asciidoctor.maven.site.ast.processors.LiteralNodeProcessor; -import org.asciidoctor.maven.site.ast.processors.OrderedListNodeProcessor; -import org.asciidoctor.maven.site.ast.processors.ParagraphNodeProcessor; -import org.asciidoctor.maven.site.ast.processors.PreambleNodeProcessor; -import org.asciidoctor.maven.site.ast.processors.SectionNodeProcessor; -import org.asciidoctor.maven.site.ast.processors.TableNodeProcessor; -import org.asciidoctor.maven.site.ast.processors.UnorderedListNodeProcessor; +import org.asciidoctor.maven.site.parser.processors.DescriptionListNodeProcessor; +import org.asciidoctor.maven.site.parser.processors.DocumentNodeProcessor; +import org.asciidoctor.maven.site.parser.processors.ImageNodeProcessor; +import org.asciidoctor.maven.site.parser.processors.ListItemNodeProcessor; +import org.asciidoctor.maven.site.parser.processors.ListingNodeProcessor; +import org.asciidoctor.maven.site.parser.processors.LiteralNodeProcessor; +import org.asciidoctor.maven.site.parser.processors.OrderedListNodeProcessor; +import org.asciidoctor.maven.site.parser.processors.ParagraphNodeProcessor; +import org.asciidoctor.maven.site.parser.processors.PreambleNodeProcessor; +import org.asciidoctor.maven.site.parser.processors.SectionNodeProcessor; +import org.asciidoctor.maven.site.parser.processors.TableNodeProcessor; +import org.asciidoctor.maven.site.parser.processors.UnorderedListNodeProcessor; /** * Document processor. diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/AbstractSinkNodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/AbstractSinkNodeProcessor.java similarity index 92% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/AbstractSinkNodeProcessor.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/AbstractSinkNodeProcessor.java index 0455063b..b6a6ff81 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/AbstractSinkNodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/AbstractSinkNodeProcessor.java @@ -1,10 +1,10 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.ast.ContentNode; /** - * Recommended base case to build a {@link org.asciidoctor.maven.site.ast.NodeProcessor}. + * Recommended base case to build a {@link org.asciidoctor.maven.site.parser.NodeProcessor}. * * @author abelsromero * @since 3.0.0 diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/DescriptionListNodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/DescriptionListNodeProcessor.java similarity index 95% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/DescriptionListNodeProcessor.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/DescriptionListNodeProcessor.java index 5073cc6a..417d543b 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/DescriptionListNodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/DescriptionListNodeProcessor.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import java.util.List; @@ -7,7 +7,7 @@ import org.asciidoctor.ast.DescriptionListEntry; import org.asciidoctor.ast.ListItem; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; /** * Description list processor. diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/DocumentNodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/DocumentNodeProcessor.java similarity index 87% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/DocumentNodeProcessor.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/DocumentNodeProcessor.java index 3e903362..5e2b6d42 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/DocumentNodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/DocumentNodeProcessor.java @@ -1,8 +1,8 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; /** * Root document processor. diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/ImageNodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/ImageNodeProcessor.java similarity index 92% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/ImageNodeProcessor.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/ImageNodeProcessor.java index 431a455c..37fe504a 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/ImageNodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/ImageNodeProcessor.java @@ -1,10 +1,10 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import java.nio.file.FileSystems; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; import static org.asciidoctor.maven.commons.StringUtils.isBlank; diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/ListItemNodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/ListItemNodeProcessor.java similarity index 95% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/ListItemNodeProcessor.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/ListItemNodeProcessor.java index 945fabd9..a84586f4 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/ListItemNodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/ListItemNodeProcessor.java @@ -1,11 +1,11 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import java.util.List; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.ast.ListItem; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; /** * List items processor, including numbered and unnumbered. diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/ListingNodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/ListingNodeProcessor.java similarity index 96% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/ListingNodeProcessor.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/ListingNodeProcessor.java index f537ab97..4e9c40d3 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/ListingNodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/ListingNodeProcessor.java @@ -1,9 +1,9 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.ast.StructuralNode; import org.asciidoctor.jruby.ast.impl.BlockImpl; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; import static org.asciidoctor.maven.commons.StringUtils.isNotBlank; diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/LiteralNodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/LiteralNodeProcessor.java similarity index 90% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/LiteralNodeProcessor.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/LiteralNodeProcessor.java index 10ff2c3b..e4183917 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/LiteralNodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/LiteralNodeProcessor.java @@ -1,9 +1,9 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.ast.StructuralNode; import org.asciidoctor.jruby.ast.impl.BlockImpl; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; /** * Literal (aka. monospace) text processor. diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/OrderedListNodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/OrderedListNodeProcessor.java similarity index 93% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/OrderedListNodeProcessor.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/OrderedListNodeProcessor.java index 0b85dc25..a3fadd66 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/OrderedListNodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/OrderedListNodeProcessor.java @@ -1,10 +1,10 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import java.util.List; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; /** * Ordered list processor. diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/ParagraphNodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/ParagraphNodeProcessor.java similarity index 89% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/ParagraphNodeProcessor.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/ParagraphNodeProcessor.java index f49c622a..160cd043 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/ParagraphNodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/ParagraphNodeProcessor.java @@ -1,8 +1,8 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; /** * Paragraph processor. diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/PreambleNodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/PreambleNodeProcessor.java similarity index 86% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/PreambleNodeProcessor.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/PreambleNodeProcessor.java index 423819c0..dab84c86 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/PreambleNodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/PreambleNodeProcessor.java @@ -1,8 +1,8 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; /** * Document preamble processor. diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/SectionNodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/SectionNodeProcessor.java similarity index 96% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/SectionNodeProcessor.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/SectionNodeProcessor.java index 844f51b8..c637fbb1 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/SectionNodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/SectionNodeProcessor.java @@ -1,10 +1,10 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.ast.Section; import org.asciidoctor.ast.StructuralNode; import org.asciidoctor.jruby.ast.impl.SectionImpl; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; /** * Section title processor. diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/TableNodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/TableNodeProcessor.java similarity index 95% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/TableNodeProcessor.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/TableNodeProcessor.java index e07ff5d3..1b47b353 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/TableNodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/TableNodeProcessor.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import java.util.List; @@ -7,7 +7,7 @@ import org.asciidoctor.ast.Row; import org.asciidoctor.ast.StructuralNode; import org.asciidoctor.jruby.ast.impl.TableImpl; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; import static org.apache.maven.doxia.sink.Sink.JUSTIFY_LEFT; import static org.asciidoctor.maven.commons.StringUtils.isBlank; diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/UnorderedListNodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/UnorderedListNodeProcessor.java similarity index 92% rename from asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/UnorderedListNodeProcessor.java rename to asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/UnorderedListNodeProcessor.java index d91ed183..ecf67fbf 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/ast/processors/UnorderedListNodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/UnorderedListNodeProcessor.java @@ -1,10 +1,10 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import java.util.List; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; /** * Unordered list processor. diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/AsciidoctorAstDoxiaParserTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/AsciidoctorAstDoxiaParserTest.java similarity index 95% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/AsciidoctorAstDoxiaParserTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/AsciidoctorAstDoxiaParserTest.java index bd74be01..6b1ef90e 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/AsciidoctorAstDoxiaParserTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/AsciidoctorAstDoxiaParserTest.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast; +package org.asciidoctor.maven.site.parser; import lombok.SneakyThrows; import org.apache.maven.doxia.parser.AbstractTextParser; @@ -12,10 +12,10 @@ import java.io.*; -import static org.asciidoctor.maven.site.ast.AsciidoctorAstDoxiaParserTest.TestMocks.mockAsciidoctorDoxiaParser; -import static org.asciidoctor.maven.site.ast.processors.test.ReflectionUtils.extractField; -import static org.asciidoctor.maven.site.ast.processors.test.StringTestUtils.clean; -import static org.asciidoctor.maven.site.ast.processors.test.TestNodeProcessorFactory.createSink; +import static org.asciidoctor.maven.site.parser.AsciidoctorAstDoxiaParserTest.TestMocks.mockAsciidoctorDoxiaParser; +import static org.asciidoctor.maven.site.parser.processors.test.ReflectionUtils.extractField; +import static org.asciidoctor.maven.site.parser.processors.test.StringTestUtils.clean; +import static org.asciidoctor.maven.site.parser.processors.test.TestNodeProcessorFactory.createSink; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; import static org.codehaus.plexus.util.ReflectionUtils.setVariableValueInObject; diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/NodeSinkerTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/NodeSinkerTest.java similarity index 95% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/NodeSinkerTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/NodeSinkerTest.java index 25f97d52..39756a46 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/NodeSinkerTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/NodeSinkerTest.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast; +package org.asciidoctor.maven.site.parser; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.ast.Document; @@ -15,8 +15,8 @@ import java.io.StringWriter; import java.util.Arrays; -import static org.asciidoctor.maven.site.ast.processors.test.ReflectionUtils.extractField; -import static org.asciidoctor.maven.site.ast.processors.test.TestNodeProcessorFactory.createSink; +import static org.asciidoctor.maven.site.parser.processors.test.ReflectionUtils.extractField; +import static org.asciidoctor.maven.site.parser.processors.test.TestNodeProcessorFactory.createSink; import static org.assertj.core.api.Assertions.assertThat; /** diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/DescriptionListNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/DescriptionListNodeProcessorTest.java similarity index 84% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/DescriptionListNodeProcessorTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/DescriptionListNodeProcessorTest.java index 8a3864c4..740364d3 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/DescriptionListNodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/DescriptionListNodeProcessorTest.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import java.io.StringWriter; import java.util.Arrays; @@ -8,21 +8,21 @@ import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; -import org.asciidoctor.maven.site.ast.processors.test.NodeProcessorTest; +import org.asciidoctor.maven.site.parser.NodeProcessor; +import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.asciidoctor.maven.site.ast.processors.test.Html.LIST_STYLE_TYPE_DECIMAL; -import static org.asciidoctor.maven.site.ast.processors.test.Html.dd; -import static org.asciidoctor.maven.site.ast.processors.test.Html.dt; -import static org.asciidoctor.maven.site.ast.processors.test.Html.italics; -import static org.asciidoctor.maven.site.ast.processors.test.Html.li; -import static org.asciidoctor.maven.site.ast.processors.test.Html.monospace; -import static org.asciidoctor.maven.site.ast.processors.test.Html.ol; -import static org.asciidoctor.maven.site.ast.processors.test.Html.strong; -import static org.asciidoctor.maven.site.ast.processors.test.Html.ul; -import static org.asciidoctor.maven.site.ast.processors.test.StringTestUtils.clean; +import static org.asciidoctor.maven.site.parser.processors.test.Html.LIST_STYLE_TYPE_DECIMAL; +import static org.asciidoctor.maven.site.parser.processors.test.Html.dd; +import static org.asciidoctor.maven.site.parser.processors.test.Html.dt; +import static org.asciidoctor.maven.site.parser.processors.test.Html.italics; +import static org.asciidoctor.maven.site.parser.processors.test.Html.li; +import static org.asciidoctor.maven.site.parser.processors.test.Html.monospace; +import static org.asciidoctor.maven.site.parser.processors.test.Html.ol; +import static org.asciidoctor.maven.site.parser.processors.test.Html.strong; +import static org.asciidoctor.maven.site.parser.processors.test.Html.ul; +import static org.asciidoctor.maven.site.parser.processors.test.StringTestUtils.clean; import static org.assertj.core.api.Assertions.assertThat; @NodeProcessorTest(DescriptionListNodeProcessor.class) diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/DocumentNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/DocumentNodeProcessorTest.java similarity index 86% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/DocumentNodeProcessorTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/DocumentNodeProcessorTest.java index 58192da3..6d19d252 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/DocumentNodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/DocumentNodeProcessorTest.java @@ -1,10 +1,10 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; -import org.asciidoctor.maven.site.ast.processors.test.NodeProcessorTest; +import org.asciidoctor.maven.site.parser.NodeProcessor; +import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest; import org.junit.jupiter.api.Test; import java.io.StringWriter; diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/ImageNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ImageNodeProcessorTest.java similarity index 92% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/ImageNodeProcessorTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ImageNodeProcessorTest.java index dc6bfafe..67fa00ae 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/ImageNodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ImageNodeProcessorTest.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import java.io.StringWriter; import java.nio.file.FileSystems; @@ -9,8 +9,8 @@ import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; -import org.asciidoctor.maven.site.ast.processors.test.NodeProcessorTest; +import org.asciidoctor.maven.site.parser.NodeProcessor; +import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/ListItemNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ListItemNodeProcessorTest.java similarity index 94% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/ListItemNodeProcessorTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ListItemNodeProcessorTest.java index 6f26f739..bdd8e124 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/ListItemNodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ListItemNodeProcessorTest.java @@ -1,10 +1,10 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; -import org.asciidoctor.maven.site.ast.processors.test.NodeProcessorTest; +import org.asciidoctor.maven.site.parser.NodeProcessor; +import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/ListingNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ListingNodeProcessorTest.java similarity index 92% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/ListingNodeProcessorTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ListingNodeProcessorTest.java index c1b601f3..19205f90 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/ListingNodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ListingNodeProcessorTest.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import java.io.StringWriter; import java.util.Collections; @@ -6,11 +6,11 @@ import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; -import org.asciidoctor.maven.site.ast.processors.test.NodeProcessorTest; +import org.asciidoctor.maven.site.parser.NodeProcessor; +import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest; import org.junit.jupiter.api.Test; -import static org.asciidoctor.maven.site.ast.processors.test.StringTestUtils.clean; +import static org.asciidoctor.maven.site.parser.processors.test.StringTestUtils.clean; import static org.assertj.core.api.Assertions.assertThat; @NodeProcessorTest(ListingNodeProcessor.class) diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/LiteralNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/LiteralNodeProcessorTest.java similarity index 86% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/LiteralNodeProcessorTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/LiteralNodeProcessorTest.java index f8739e53..a80f0b11 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/LiteralNodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/LiteralNodeProcessorTest.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import java.io.StringWriter; import java.util.Collections; @@ -6,8 +6,8 @@ import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; -import org.asciidoctor.maven.site.ast.processors.test.NodeProcessorTest; +import org.asciidoctor.maven.site.parser.NodeProcessor; +import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/OrderedListNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/OrderedListNodeProcessorTest.java similarity index 91% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/OrderedListNodeProcessorTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/OrderedListNodeProcessorTest.java index 6fb7687f..e29d9d2a 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/OrderedListNodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/OrderedListNodeProcessorTest.java @@ -1,11 +1,11 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; -import org.asciidoctor.maven.site.ast.processors.test.NodeProcessorTest; +import org.asciidoctor.maven.site.parser.NodeProcessor; +import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -13,7 +13,7 @@ import java.util.Arrays; import java.util.Collections; -import static org.asciidoctor.maven.site.ast.processors.test.StringTestUtils.clean; +import static org.asciidoctor.maven.site.parser.processors.test.StringTestUtils.clean; import static org.assertj.core.api.Assertions.assertThat; @NodeProcessorTest(OrderedListNodeProcessor.class) diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/ParagraphNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ParagraphNodeProcessorTest.java similarity index 92% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/ParagraphNodeProcessorTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ParagraphNodeProcessorTest.java index d60d137c..4ced15b8 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/ParagraphNodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ParagraphNodeProcessorTest.java @@ -1,10 +1,10 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; -import org.asciidoctor.maven.site.ast.processors.test.NodeProcessorTest; +import org.asciidoctor.maven.site.parser.NodeProcessor; +import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest; import org.junit.jupiter.api.Test; import java.io.StringWriter; diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/PreambleNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/PreambleNodeProcessorTest.java similarity index 89% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/PreambleNodeProcessorTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/PreambleNodeProcessorTest.java index 77d76cdb..6900ae27 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/PreambleNodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/PreambleNodeProcessorTest.java @@ -1,10 +1,10 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; -import org.asciidoctor.maven.site.ast.processors.test.NodeProcessorTest; +import org.asciidoctor.maven.site.parser.NodeProcessor; +import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest; import org.junit.jupiter.api.Test; import java.io.StringWriter; diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/SectionNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/SectionNodeProcessorTest.java similarity index 96% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/SectionNodeProcessorTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/SectionNodeProcessorTest.java index e9c3cfce..69fb9672 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/SectionNodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/SectionNodeProcessorTest.java @@ -1,11 +1,11 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import org.asciidoctor.Asciidoctor; import org.asciidoctor.Attributes; import org.asciidoctor.Options; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; -import org.asciidoctor.maven.site.ast.processors.test.NodeProcessorTest; +import org.asciidoctor.maven.site.parser.NodeProcessor; +import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest; import org.junit.jupiter.api.Test; import java.io.StringWriter; diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/TableNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/TableNodeProcessorTest.java similarity index 88% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/TableNodeProcessorTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/TableNodeProcessorTest.java index dd4e45fd..2221a989 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/TableNodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/TableNodeProcessorTest.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import java.io.StringWriter; import java.util.Arrays; @@ -9,17 +9,17 @@ import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; -import org.asciidoctor.maven.site.ast.processors.test.NodeProcessorTest; +import org.asciidoctor.maven.site.parser.NodeProcessor; +import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest; import org.junit.jupiter.api.Test; import static java.util.Collections.emptyList; -import static org.asciidoctor.maven.site.ast.processors.TableNodeProcessorTest.DocumentBuilder.CaptionOptions.disableLabelForTable; -import static org.asciidoctor.maven.site.ast.processors.TableNodeProcessorTest.DocumentBuilder.CaptionOptions.disableLabelsGlobally; -import static org.asciidoctor.maven.site.ast.processors.TableNodeProcessorTest.DocumentBuilder.CaptionOptions.noCaption; -import static org.asciidoctor.maven.site.ast.processors.TableNodeProcessorTest.DocumentBuilder.CaptionOptions.simpleCaption; -import static org.asciidoctor.maven.site.ast.processors.TableNodeProcessorTest.DocumentBuilder.documentWithTable; -import static org.asciidoctor.maven.site.ast.processors.test.StringTestUtils.clean; +import static org.asciidoctor.maven.site.parser.processors.TableNodeProcessorTest.DocumentBuilder.CaptionOptions.disableLabelForTable; +import static org.asciidoctor.maven.site.parser.processors.TableNodeProcessorTest.DocumentBuilder.CaptionOptions.disableLabelsGlobally; +import static org.asciidoctor.maven.site.parser.processors.TableNodeProcessorTest.DocumentBuilder.CaptionOptions.noCaption; +import static org.asciidoctor.maven.site.parser.processors.TableNodeProcessorTest.DocumentBuilder.CaptionOptions.simpleCaption; +import static org.asciidoctor.maven.site.parser.processors.TableNodeProcessorTest.DocumentBuilder.documentWithTable; +import static org.asciidoctor.maven.site.parser.processors.test.StringTestUtils.clean; import static org.assertj.core.api.Assertions.assertThat; /** diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/UnorderedListNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/UnorderedListNodeProcessorTest.java similarity index 91% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/UnorderedListNodeProcessorTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/UnorderedListNodeProcessorTest.java index 2276835c..c026de56 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/UnorderedListNodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/UnorderedListNodeProcessorTest.java @@ -1,11 +1,11 @@ -package org.asciidoctor.maven.site.ast.processors; +package org.asciidoctor.maven.site.parser.processors; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.asciidoctor.ast.StructuralNode; -import org.asciidoctor.maven.site.ast.NodeProcessor; -import org.asciidoctor.maven.site.ast.processors.test.NodeProcessorTest; +import org.asciidoctor.maven.site.parser.NodeProcessor; +import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -13,7 +13,7 @@ import java.util.Arrays; import java.util.Collections; -import static org.asciidoctor.maven.site.ast.processors.test.StringTestUtils.clean; +import static org.asciidoctor.maven.site.parser.processors.test.StringTestUtils.clean; import static org.assertj.core.api.Assertions.assertThat; @NodeProcessorTest(UnorderedListNodeProcessor.class) diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/Html.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/Html.java similarity index 95% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/Html.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/Html.java index d3e9abf6..68d54f8f 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/Html.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/Html.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast.processors.test; +package org.asciidoctor.maven.site.parser.processors.test; public class Html { diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/JUnitNodeProcessorExtension.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/JUnitNodeProcessorExtension.java similarity index 83% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/JUnitNodeProcessorExtension.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/JUnitNodeProcessorExtension.java index 48c2b5f0..884d7a8d 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/JUnitNodeProcessorExtension.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/JUnitNodeProcessorExtension.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast.processors.test; +package org.asciidoctor.maven.site.parser.processors.test; import java.io.StringWriter; import java.lang.reflect.Field; @@ -6,13 +6,13 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.maven.doxia.sink.Sink; import org.asciidoctor.Asciidoctor; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestInstancePostProcessor; -import static org.asciidoctor.maven.site.ast.processors.test.ReflectionUtils.extractField; -import static org.asciidoctor.maven.site.ast.processors.test.ReflectionUtils.findField; -import static org.asciidoctor.maven.site.ast.processors.test.ReflectionUtils.injectField; +import static org.asciidoctor.maven.site.parser.processors.test.ReflectionUtils.extractField; +import static org.asciidoctor.maven.site.parser.processors.test.ReflectionUtils.findField; +import static org.asciidoctor.maven.site.parser.processors.test.ReflectionUtils.injectField; public class JUnitNodeProcessorExtension implements TestInstancePostProcessor { diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/NodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/NodeProcessorTest.java similarity index 78% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/NodeProcessorTest.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/NodeProcessorTest.java index 5bc8a554..5f749c3e 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/NodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/NodeProcessorTest.java @@ -1,11 +1,11 @@ -package org.asciidoctor.maven.site.ast.processors.test; +package org.asciidoctor.maven.site.parser.processors.test; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; import org.junit.jupiter.api.extension.ExtendWith; @Target({ElementType.TYPE}) diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/ReflectionUtils.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/ReflectionUtils.java similarity index 94% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/ReflectionUtils.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/ReflectionUtils.java index 9c40d257..c43fb8eb 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/ReflectionUtils.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/ReflectionUtils.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast.processors.test; +package org.asciidoctor.maven.site.parser.processors.test; import java.io.StringWriter; import java.lang.reflect.Field; diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/StringTestUtils.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/StringTestUtils.java similarity index 84% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/StringTestUtils.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/StringTestUtils.java index 766517bc..a699d2bb 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/StringTestUtils.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/StringTestUtils.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast.processors.test; +package org.asciidoctor.maven.site.parser.processors.test; public class StringTestUtils { diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/TestNodeProcessorFactory.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/TestNodeProcessorFactory.java similarity index 87% rename from asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/TestNodeProcessorFactory.java rename to asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/TestNodeProcessorFactory.java index 2eb96986..875e5404 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/ast/processors/test/TestNodeProcessorFactory.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/test/TestNodeProcessorFactory.java @@ -1,4 +1,4 @@ -package org.asciidoctor.maven.site.ast.processors.test; +package org.asciidoctor.maven.site.parser.processors.test; import java.lang.reflect.Constructor; @@ -7,7 +7,7 @@ import org.apache.maven.doxia.sink.Sink; import org.apache.maven.doxia.siterenderer.RenderingContext; import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink; -import org.asciidoctor.maven.site.ast.NodeProcessor; +import org.asciidoctor.maven.site.parser.NodeProcessor; import org.mockito.Mockito; public class TestNodeProcessorFactory { diff --git a/docs/modules/site-integration/nav.adoc b/docs/modules/site-integration/nav.adoc index 8c958f9d..0438f668 100644 --- a/docs/modules/site-integration/nav.adoc +++ b/docs/modules/site-integration/nav.adoc @@ -3,6 +3,7 @@ ** Modules *** xref:converter-module-setup-and-configuration.adoc[] *** xref:parser-module-setup-and-configuration.adoc[] -** xref:compatibility-matrix.adoc[] +*** xref:exposed-metadata.adoc[] +*** xref:compatibility-matrix.adoc[] ** Help & Guides *** xref:v3-migration-guide.adoc[] diff --git a/docs/modules/site-integration/pages/exposed-metadata.adoc b/docs/modules/site-integration/pages/exposed-metadata.adoc new file mode 100644 index 00000000..d9d6e206 --- /dev/null +++ b/docs/modules/site-integration/pages/exposed-metadata.adoc @@ -0,0 +1,17 @@ += Exposed metadata +:asciidoctor-docs-url: https://docs.asciidoctor.org/asciidoc/latest +:maven-site-plugin-docs-url: https://maven.apache.org/plugins/maven-site-plugin + +The Asciidoctor Maven Site integration collaborates with Doxia to expose some of its information. + +== Document Header metadata + +The following elements from the {asciidoctor-docs-url}/document/header/[header] are integrated: + +document title:: used to inform the {maven-site-plugin-docs-url}/examples/sitedescriptor.html#Breadcrumbs[breadcrumb] line when these are enabled. + +author(s):: full representation (full name and email) will be present as HTML `` tags inside the HTML ``. +In case of multiple authors, each one will appear in a distinct `meta` element. + +revision date:: the header revision date value will be presented as-is in a `` element. +Alternatively, if not set, the generated value of `docdatetime` will be used.