This is an automated email from the ASF dual-hosted git repository.

vy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j-tools.git

commit d1bc34f91b6445107691aedfa051ecaf260a7f7f
Author: Volkan Yazıcı <[email protected]>
AuthorDate: Wed Mar 13 10:25:33 2024 +0100

    Add `log4j-docgen-asciidoctor-extension` module for `apiref` inline macro
---
 log4j-docgen-asciidoctor-extension/pom.xml         |  65 ++++++
 .../log4j/docgen/asciidoctor/ApirefMacro.java      | 232 +++++++++++++++++++++
 .../log4j/docgen/asciidoctor/DocgenExtension.java  |  33 +++
 log4j-docgen/pom.xml                               |   2 -
 .../docgen/generator/DocumentationGenerator.java   |   2 +
 .../log4j/docgen/generator/SchemaGenerator.java    |   2 +
 .../{ => internal}/ArtifactSourcedType.java        |   2 +-
 .../generator/{ => internal}/TypeLookup.java       |   7 +-
 .../docgen/generator/internal/package-info.java    |  26 +++
 .../templates/index.adoc.ftl                       |   4 +-
 .../templates/type.adoc.ftl                        |   2 +-
 log4j-tools-parent/pom.xml                         |  13 ++
 pom.xml                                            |   1 +
 13 files changed, 382 insertions(+), 9 deletions(-)

diff --git a/log4j-docgen-asciidoctor-extension/pom.xml 
b/log4j-docgen-asciidoctor-extension/pom.xml
new file mode 100644
index 0000000..f9b50ce
--- /dev/null
+++ b/log4j-docgen-asciidoctor-extension/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to you under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.logging.log4j</groupId>
+    <artifactId>log4j-tools-parent</artifactId>
+    <version>${revision}</version>
+    <relativePath>../log4j-tools-parent</relativePath>
+  </parent>
+
+  <artifactId>log4j-docgen-asciidoctor-extension</artifactId>
+
+  <properties>
+
+    <!-- Disabling `bnd-baseline-maven-plugin`, since we don't have a release 
yet to compare against. -->
+    <bnd.baseline.fail.on.missing>false</bnd.baseline.fail.on.missing>
+
+  </properties>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-docgen</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jspecify</groupId>
+      <artifactId>jspecify</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>biz.aQute.bnd</groupId>
+      <artifactId>biz.aQute.bnd.annotation</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.asciidoctor</groupId>
+      <artifactId>asciidoctorj</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+  </dependencies>
+
+</project>
diff --git 
a/log4j-docgen-asciidoctor-extension/src/main/java/org/apache/logging/log4j/docgen/asciidoctor/ApirefMacro.java
 
b/log4j-docgen-asciidoctor-extension/src/main/java/org/apache/logging/log4j/docgen/asciidoctor/ApirefMacro.java
new file mode 100644
index 0000000..b964989
--- /dev/null
+++ 
b/log4j-docgen-asciidoctor-extension/src/main/java/org/apache/logging/log4j/docgen/asciidoctor/ApirefMacro.java
@@ -0,0 +1,232 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.docgen.asciidoctor;
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.PathMatcher;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Predicate;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Pattern;
+import java.util.stream.Stream;
+import org.apache.logging.log4j.docgen.PluginSet;
+import org.apache.logging.log4j.docgen.generator.internal.ArtifactSourcedType;
+import org.apache.logging.log4j.docgen.generator.internal.TypeLookup;
+import org.apache.logging.log4j.docgen.io.stax.PluginBundleStaxReader;
+import org.asciidoctor.ast.PhraseNode;
+import org.asciidoctor.ast.StructuralNode;
+import org.asciidoctor.extension.Format;
+import org.asciidoctor.extension.FormatType;
+import org.asciidoctor.extension.InlineMacroProcessor;
+import org.asciidoctor.extension.Name;
+import org.asciidoctor.extension.PositionalAttributes;
+import org.jspecify.annotations.Nullable;
+
+@Name("apiref")
+@Format(FormatType.LONG)
+@PositionalAttributes({"label"})
+public final class ApirefMacro extends InlineMacroProcessor {
+
+    private static final Logger LOGGER = 
Logger.getLogger(ApirefMacro.class.getName());
+
+    private TypeLookup lookup;
+
+    private String typeTemplateTarget;
+
+    private boolean initialized = false;
+
+    @Override
+    public PhraseNode process(final StructuralNode parent, final String 
target, final Map<String, Object> attributes) {
+        initialize(parent);
+        return createPhraseNode(parent, target, attributes);
+    }
+
+    private PhraseNode createPhraseNode(
+            final StructuralNode parent, final String target, final 
Map<String, Object> attributes) {
+        final int methodSplitterIndex = target.indexOf('#');
+        final boolean methodProvided = methodSplitterIndex > 0;
+        final String className = methodProvided ? target.substring(0, 
methodSplitterIndex) : target;
+        @Nullable final String label = (String) attributes.get("label");
+
+        // If this is a type we expect to find in an AsciiDoc file produced by 
`DocumentationGenerator`
+        @Nullable final ArtifactSourcedType sourcedType = 
lookup.get(className);
+        if (sourcedType != null) {
+            Map<String, Object> nodeOptions = new HashMap<>();
+            nodeOptions.put("type", ":xref");
+            nodeOptions.put("target", 
createTypeTemplateTargetPath(sourcedType));
+            final String effectiveLabel = label != null ? label : 
className.substring(className.lastIndexOf('.') + 1);
+            return createPhraseNode(parent, "anchor", effectiveLabel, 
attributes, nodeOptions);
+        }
+
+        // Otherwise we don't know the link
+        final String effectiveLabel = label != null ? label : target;
+        return createPhraseNode(parent, "quoted", effectiveLabel, attributes);
+    }
+
+    private String createTypeTemplateTargetPath(final ArtifactSourcedType 
sourcedType) {
+        final String groupId = or(sourcedType.groupId, "unknown-groupId");
+        final String artifactId = or(sourcedType.artifactId, 
"unknown-artifactId");
+        final String version = or(sourcedType.version, "unknown-version");
+        return typeTemplateTarget
+                .replaceAll("%g", groupId)
+                .replaceAll("%a", artifactId)
+                .replaceAll("%v", version)
+                .replaceAll("%c", sourcedType.type.getClassName());
+    }
+
+    private static String or(@Nullable final String value, final String 
fallback) {
+        return value != null ? value : fallback;
+    }
+
+    private void initialize(final StructuralNode node) {
+        if (!initialized) {
+            LOGGER.fine("Initializing...");
+            lookup = createTypeLookup(node);
+            final Map<String, Object> documentAttributes = 
node.getDocument().getAttributes();
+            typeTemplateTarget = getStringAttribute(documentAttributes, 
attributeName("type-template-target"), null);
+            initialized = true;
+            LOGGER.fine("Initialized.");
+        }
+    }
+
+    private TypeLookup createTypeLookup(final StructuralNode node) {
+        final Set<PluginSet> pluginSets = loadDescriptors(node);
+        final Map<String, Object> documentAttributes = 
node.getDocument().getAttributes();
+        final Pattern includePattern =
+                getPatternAttribute(documentAttributes, 
attributeName("type-filter-include-pattern"), ".*");
+        final Pattern excludePattern =
+                getPatternAttribute(documentAttributes, 
attributeName("type-filter-exclude-pattern"), "(?!.*)");
+        LOGGER.log(
+                Level.FINE,
+                "Creating type lookup using `%s` and `%s` patterns for 
inclusion and exclusion, respectively...",
+                new Object[] {includePattern, excludePattern});
+        final Predicate<String> classNameFilter =
+                className -> includePattern.matcher(className).matches()
+                        && !excludePattern.matcher(className).matches();
+        return TypeLookup.of(pluginSets, classNameFilter);
+    }
+
+    private Set<PluginSet> loadDescriptors(final StructuralNode node) {
+        final Map<String, Object> documentAttributes = 
node.getDocument().getAttributes();
+        final String directory = getStringAttribute(documentAttributes, 
attributeName("descriptor-directory"), null);
+        final String pathMatcher =
+                getStringAttribute(documentAttributes, 
attributeName("descriptor-path-matcher"), "glob:**/*.xml");
+        final String dotFilesExcludedString =
+                getStringAttribute(documentAttributes, 
attributeName("descriptor-dot-files-excluded"), "true");
+        final boolean dotFilesExcluded = 
Boolean.parseBoolean(dotFilesExcludedString);
+        LOGGER.log(
+                Level.FINE,
+                "Loading descriptors matching `{}` pattern in `{}`... (Dot 
files will be {})",
+                new Object[] {pathMatcher, directory, dotFilesExcluded ? 
"ignored." : "included!"});
+        final Set<PluginSet> pluginSets = loadDescriptors(directory, 
pathMatcher, dotFilesExcluded);
+        LOGGER.log(Level.FINE, "Loaded {} descriptors in total.", 
pluginSets.size());
+        return pluginSets;
+    }
+
+    private static String attributeName(final String key) {
+        final String attributeName = "log4j-docgen-" + key;
+        if (key.matches(".*[^a-z-]+.*")) {
+            final String message = String.format(
+                    "Found invalid attribute name: `%s`.%n"
+                            + "`node.getDocument().getAttributes()` lower 
cases all attribute names and replaces symbols with dashes.%n"
+                            + "Hence, you should use kebab-case attribute 
names.",
+                    attributeName);
+            throw new IllegalArgumentException(message);
+        }
+        return attributeName;
+    }
+
+    private static Pattern getPatternAttribute(
+            final Map<String, Object> documentAttributes, final String key, 
final String defaultValue) {
+        final String regex = getStringAttribute(documentAttributes, key, 
defaultValue);
+        try {
+            return Pattern.compile(regex);
+        } catch (final Exception error) {
+            final String message =
+                    String.format("failed compiling the regex pattern `%s` 
provided in attribute `%s`", regex, key);
+            throw new IllegalArgumentException(message, error);
+        }
+    }
+
+    private static String getStringAttribute(
+            final Map<String, Object> documentAttributes, final String key, 
@Nullable final String defaultValue) {
+        final Object value = documentAttributes.get(key);
+        final String textValue;
+        if (!(value instanceof String) || (textValue = ((String) 
value).trim()).isEmpty()) {
+            if (defaultValue == null) {
+                final String message = String.format("blank or missing 
attribute: `%s`", key);
+                throw new IllegalArgumentException(message);
+            } else {
+                return defaultValue;
+            }
+        }
+        return textValue;
+    }
+
+    private Set<PluginSet> loadDescriptors(
+            final String directory, final String pathPattern, final boolean 
dotFilesExcluded) {
+        final Set<PluginSet> pluginSets = new LinkedHashSet<>();
+        final PluginBundleStaxReader pluginSetReader = new 
PluginBundleStaxReader();
+        final PathMatcher pathMatcher = 
FileSystems.getDefault().getPathMatcher(pathPattern);
+        try (final Stream<Path> paths = Files.walk(Paths.get(directory))) {
+            paths.forEach(path -> {
+
+                // Skip directories
+                if (Files.isDirectory(path)) {
+                    return;
+                }
+
+                // Skip dot files
+                final boolean dotFile =
+                        dotFilesExcluded && 
path.getFileName().toString().startsWith(".");
+                if (dotFile) {
+                    return;
+                }
+
+                // Skip mismatching paths
+                final boolean matched = pathMatcher.matches(path);
+                if (!matched) {
+                    return;
+                }
+
+                // Read the descriptor
+                final PluginSet pluginSet;
+                try {
+                    pluginSet = pluginSetReader.read(path.toString());
+                } catch (final Exception error) {
+                    final String message = String.format("failed reading 
descriptor: `%s`", path);
+                    throw new RuntimeException(message, error);
+                }
+                pluginSets.add(pluginSet);
+                LOGGER.log(Level.FINE, "Loaded descriptor at `{}`.", new 
Object[] {path});
+            });
+        } catch (final IOException error) {
+            final String message = String.format("failed reading descriptors 
from directory: `%s`", directory);
+            throw new UncheckedIOException(message, error);
+        }
+        return pluginSets;
+    }
+}
diff --git 
a/log4j-docgen-asciidoctor-extension/src/main/java/org/apache/logging/log4j/docgen/asciidoctor/DocgenExtension.java
 
b/log4j-docgen-asciidoctor-extension/src/main/java/org/apache/logging/log4j/docgen/asciidoctor/DocgenExtension.java
new file mode 100644
index 0000000..e3bd11b
--- /dev/null
+++ 
b/log4j-docgen-asciidoctor-extension/src/main/java/org/apache/logging/log4j/docgen/asciidoctor/DocgenExtension.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.docgen.asciidoctor;
+
+import aQute.bnd.annotation.Resolution;
+import aQute.bnd.annotation.spi.ServiceProvider;
+import org.asciidoctor.Asciidoctor;
+import org.asciidoctor.extension.JavaExtensionRegistry;
+import org.asciidoctor.jruby.extension.spi.ExtensionRegistry;
+
+@ServiceProvider(value = ExtensionRegistry.class, resolution = 
Resolution.OPTIONAL)
+public class DocgenExtension implements ExtensionRegistry {
+
+    @Override
+    public void register(Asciidoctor asciidoctor) {
+        final JavaExtensionRegistry extensionRegistry = 
asciidoctor.javaExtensionRegistry();
+        extensionRegistry.inlineMacro("apiref", ApirefMacro.class);
+    }
+}
diff --git a/log4j-docgen/pom.xml b/log4j-docgen/pom.xml
index 17d56e7..76ad33f 100644
--- a/log4j-docgen/pom.xml
+++ b/log4j-docgen/pom.xml
@@ -35,7 +35,6 @@
     <bnd.baseline.fail.on.missing>false</bnd.baseline.fail.on.missing>
 
     <!-- Dependency versions -->
-    <asciidoctorj-api.version>3.0.0-alpha.2</asciidoctorj-api.version>
     <!-- We explicitly test against Log4j 2 -->
     <log4j-core.version>2.23.1</log4j-core.version>
     <log4j-plugins.version>3.0.0-beta2</log4j-plugins.version>
@@ -65,7 +64,6 @@
     <dependency>
       <groupId>org.asciidoctor</groupId>
       <artifactId>asciidoctorj-api</artifactId>
-      <version>${asciidoctorj-api.version}</version>
     </dependency>
 
     <dependency>
diff --git 
a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/DocumentationGenerator.java
 
b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/DocumentationGenerator.java
index 5bc04f8..9d26559 100644
--- 
a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/DocumentationGenerator.java
+++ 
b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/DocumentationGenerator.java
@@ -25,6 +25,8 @@ import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import org.apache.logging.log4j.docgen.PluginSet;
+import org.apache.logging.log4j.docgen.generator.internal.ArtifactSourcedType;
+import org.apache.logging.log4j.docgen.generator.internal.TypeLookup;
 import org.jspecify.annotations.Nullable;
 
 public final class DocumentationGenerator {
diff --git 
a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/SchemaGenerator.java
 
b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/SchemaGenerator.java
index 9a7cccc..0840a53 100644
--- 
a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/SchemaGenerator.java
+++ 
b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/SchemaGenerator.java
@@ -43,6 +43,8 @@ import org.apache.logging.log4j.docgen.PluginType;
 import org.apache.logging.log4j.docgen.ScalarType;
 import org.apache.logging.log4j.docgen.ScalarValue;
 import org.apache.logging.log4j.docgen.Type;
+import org.apache.logging.log4j.docgen.generator.internal.ArtifactSourcedType;
+import org.apache.logging.log4j.docgen.generator.internal.TypeLookup;
 import org.jspecify.annotations.Nullable;
 
 @Singleton
diff --git 
a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/ArtifactSourcedType.java
 
b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/internal/ArtifactSourcedType.java
similarity index 96%
rename from 
log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/ArtifactSourcedType.java
rename to 
log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/internal/ArtifactSourcedType.java
index 4a5dd39..71b31f3 100644
--- 
a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/ArtifactSourcedType.java
+++ 
b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/internal/ArtifactSourcedType.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.logging.log4j.docgen.generator;
+package org.apache.logging.log4j.docgen.generator.internal;
 
 import static java.util.Objects.requireNonNull;
 
diff --git 
a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/TypeLookup.java
 
b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/internal/TypeLookup.java
similarity index 95%
rename from 
log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/TypeLookup.java
rename to 
log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/internal/TypeLookup.java
index 598fcfc..d32bd00 100644
--- 
a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/TypeLookup.java
+++ 
b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/internal/TypeLookup.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.logging.log4j.docgen.generator;
+package org.apache.logging.log4j.docgen.generator.internal;
 
 import java.util.Iterator;
 import java.util.Set;
@@ -25,11 +25,12 @@ import org.apache.logging.log4j.docgen.PluginSet;
 import org.apache.logging.log4j.docgen.PluginType;
 import org.jspecify.annotations.Nullable;
 
-final class TypeLookup extends TreeMap<String, ArtifactSourcedType> {
+public final class TypeLookup extends TreeMap<String, ArtifactSourcedType> {
 
     private static final long serialVersionUID = 1L;
 
-    static TypeLookup of(final Iterable<? extends PluginSet> pluginSets, final 
Predicate<String> classNameFilter) {
+    public static TypeLookup of(
+            final Iterable<? extends PluginSet> pluginSets, final 
Predicate<String> classNameFilter) {
         return new TypeLookup(pluginSets, classNameFilter);
     }
 
diff --git 
a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/internal/package-info.java
 
b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/internal/package-info.java
new file mode 100644
index 0000000..cc5b947
--- /dev/null
+++ 
b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/internal/package-info.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+@Export
+@ExportTo("org.apache.logging.log4j.docgen.asciidoctor.extension")
+@Version("1.0.0")
+@NullMarked
+package org.apache.logging.log4j.docgen.generator.internal;
+
+import aQute.bnd.annotation.jpms.ExportTo;
+import org.jspecify.annotations.NullMarked;
+import org.osgi.annotation.bundle.Export;
+import org.osgi.annotation.versioning.Version;
diff --git 
a/log4j-docgen/src/test/resources/DocumentationGeneratorTest/templates/index.adoc.ftl
 
b/log4j-docgen/src/test/resources/DocumentationGeneratorTest/templates/index.adoc.ftl
index 1e5f1d3..f631753 100644
--- 
a/log4j-docgen/src/test/resources/DocumentationGeneratorTest/templates/index.adoc.ftl
+++ 
b/log4j-docgen/src/test/resources/DocumentationGeneratorTest/templates/index.adoc.ftl
@@ -15,13 +15,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 -->
-<#-- @ftlvariable name="lookup" 
type="org.apache.logging.log4j.docgen.generator.TypeLookup" -->
+<#-- @ftlvariable name="lookup" 
type="org.apache.logging.log4j.docgen.generator.internal.TypeLookup" -->
 <#include "license.adoc">
 
 [#index]
 = Index
 <#assign sourcedTypes = lookup?values/>
-<#-- @ftlvariable name="sourcedTypes" 
type="org.apache.logging.log4j.docgen.generator.ArtifactSourcedType[]" -->
+<#-- @ftlvariable name="sourcedTypes" 
type="org.apache.logging.log4j.docgen.generator.internal.ArtifactSourcedType[]" 
-->
 <#assign lastGroupId = ''/>
 <#assign lastArtifactId = ''/>
 <#list sourcedTypes?sort_by('groupId', 'artifactId', ['type', 'className']) as 
sourcedType>
diff --git 
a/log4j-docgen/src/test/resources/DocumentationGeneratorTest/templates/type.adoc.ftl
 
b/log4j-docgen/src/test/resources/DocumentationGeneratorTest/templates/type.adoc.ftl
index 4e18c22..b7c5a75 100644
--- 
a/log4j-docgen/src/test/resources/DocumentationGeneratorTest/templates/type.adoc.ftl
+++ 
b/log4j-docgen/src/test/resources/DocumentationGeneratorTest/templates/type.adoc.ftl
@@ -18,7 +18,7 @@
 <#-- @ftlvariable name="sourcedType" 
type="org.apache.logging.log4j.docgen.model.ArtifactSourcedType" -->
 <#assign type = sourcedType.type/>
 <#-- @ftlvariable name="type" type="org.apache.logging.log4j.docgen.Type" -->
-<#-- @ftlvariable name="lookup" 
type="org.apache.logging.log4j.docgen.generator.TypeLookup" -->
+<#-- @ftlvariable name="lookup" 
type="org.apache.logging.log4j.docgen.generator.internal.TypeLookup" -->
 <#include "license.adoc">
 
 [#${type.className?replace('.', '_')}]
diff --git a/log4j-tools-parent/pom.xml b/log4j-tools-parent/pom.xml
index 272b3fa..04f8898 100644
--- a/log4j-tools-parent/pom.xml
+++ b/log4j-tools-parent/pom.xml
@@ -37,6 +37,7 @@
   <properties>
 
     <!-- Dependency versions -->
+    <asciidoctorj.version>3.0.0-alpha.2</asciidoctorj.version>
     <assertj.version>3.25.3</assertj.version>
     <commons-io.version>2.15.1</commons-io.version>
     <commons-lang3.version>3.14.0</commons-lang3.version>
@@ -69,6 +70,18 @@
         <version>${project.version}</version>
       </dependency>
 
+      <dependency>
+        <groupId>org.asciidoctor</groupId>
+        <artifactId>asciidoctorj</artifactId>
+        <version>${asciidoctorj.version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.asciidoctor</groupId>
+        <artifactId>asciidoctorj-api</artifactId>
+        <version>${asciidoctorj.version}</version>
+      </dependency>
+
       <dependency>
         <groupId>org.junit</groupId>
         <artifactId>junit-bom</artifactId>
diff --git a/pom.xml b/pom.xml
index 4089030..ef3fc5e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -87,6 +87,7 @@
     <module>log4j-changelog</module>
     <module>log4j-changelog-maven-plugin</module>
     <module>log4j-docgen</module>
+    <module>log4j-docgen-asciidoctor-extension</module>
     <module>log4j-docgen-maven-plugin</module>
 
   </modules>

Reply via email to