From 2d174003b78028ee5ec37b66614287cde4a47d6b Mon Sep 17 00:00:00 2001 From: "Matteo Franci a.k.a. Fugerit" Date: Wed, 16 Oct 2024 21:18:29 +0200 Subject: [PATCH] [fj-doc-maven-plugin] support for asciidoc doc handler (fj-doc-version 8.8.7+) --- CHANGELOG.md | 1 + .../fugerit/java/doc/project/facade/FlavourContext.java | 4 ++++ .../org/fugerit/java/doc/project/facade/VenusContext.java | 6 ++++++ .../config/template/flavour/micronaut-4/DocController.ftl | 6 +++++- .../config/template/flavour/openliberty/DocResource.ftl | 4 ++++ .../config/template/flavour/quarkus-2/DocResource.ftl | 4 ++++ .../config/template/flavour/quarkus-2/DocResourceTest.ftl | 7 +++++++ .../config/template/flavour/quarkus-3/DocResource.ftl | 4 ++++ .../config/template/flavour/quarkus-3/DocResourceTest.ftl | 7 +++++++ .../config/template/flavour/springboot-3/DocController.ftl | 6 +++++- .../config/template/fm-doc-process-config-template.ftl | 4 ++++ 11 files changed, 51 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4976df42..585e20446 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- [fj-doc-maven-plugin] support for asciidoc doc handler (fj-doc-version 8.8.7+) - [fj-doc-maven-plugin] updated readme information for quarkus-3 flavour - [fj-doc-guide] added pdf documentation - [fj-doc-playground-quarkus] fj-doc-ext-kotlin-version set to 0.4.2 diff --git a/fj-doc-maven-plugin/src/main/java/org/fugerit/java/doc/project/facade/FlavourContext.java b/fj-doc-maven-plugin/src/main/java/org/fugerit/java/doc/project/facade/FlavourContext.java index dbc8f66ca..c459f39d8 100644 --- a/fj-doc-maven-plugin/src/main/java/org/fugerit/java/doc/project/facade/FlavourContext.java +++ b/fj-doc-maven-plugin/src/main/java/org/fugerit/java/doc/project/facade/FlavourContext.java @@ -58,4 +58,8 @@ public String getArtifactIdAsClassName() { return toClassName( res, "\\." ); } + public boolean isAsciidocFreemarkerHandlerAvailable() { + return VersionCheck.isMajorThan( VenusContext.VERSION_ASCIIDOC_FREEMARKER_HANDLER, this.getVersion() ); + } + } diff --git a/fj-doc-maven-plugin/src/main/java/org/fugerit/java/doc/project/facade/VenusContext.java b/fj-doc-maven-plugin/src/main/java/org/fugerit/java/doc/project/facade/VenusContext.java index a082039e2..585ade564 100644 --- a/fj-doc-maven-plugin/src/main/java/org/fugerit/java/doc/project/facade/VenusContext.java +++ b/fj-doc-maven-plugin/src/main/java/org/fugerit/java/doc/project/facade/VenusContext.java @@ -19,6 +19,8 @@ @ToString public class VenusContext { + public static final String VERSION_ASCIIDOC_FREEMARKER_HANDLER = "8.8.6"; + public static final String VERSION_NA_VERIFY_PLUGIN = "8.7.2"; public static final String VERSION_NA_FULL_PROCESS = "8.6.2"; @@ -122,6 +124,10 @@ public boolean isVerifyPluginNotAvailable() { return VersionCheck.isMajorThan( VERSION_NA_VERIFY_PLUGIN, this.getVersion() ); } + public boolean isAsciidocFreemarkerHandlerAvailable() { + return VersionCheck.isMajorThan( VERSION_ASCIIDOC_FREEMARKER_HANDLER, this.getVersion() ); + } + public boolean isPreVersion862() { return VersionCheck.isMajorThan( VERSION_NA_FULL_PROCESS, this.getVersion() ); } diff --git a/fj-doc-maven-plugin/src/main/resources/config/template/flavour/micronaut-4/DocController.ftl b/fj-doc-maven-plugin/src/main/resources/config/template/flavour/micronaut-4/DocController.ftl index 75fa6180a..8e648b5aa 100644 --- a/fj-doc-maven-plugin/src/main/resources/config/template/flavour/micronaut-4/DocController.ftl +++ b/fj-doc-maven-plugin/src/main/resources/config/template/flavour/micronaut-4/DocController.ftl @@ -27,7 +27,11 @@ public class DocController { <@fhm.createMicronautPath context=context outputMime="text/markdown" outputExtension="md" outputDescription="Markdown"/> <@fhm.createMicronautPath context=context outputMime="text/html" outputExtension="html" outputDescription="HTML"/> - + + <#if context.asciidocFreemarkerHandlerAvailable> + <@fhm.createMicronautPath context=context outputMime="text/asciidoc" outputExtension="adoc" outputDescription="AsciiDoc"/> + + <#if context.modules?seq_contains("fj-doc-mod-fop")> <@fhm.createMicronautPath context=context outputMime="application/pdf" outputExtension="pdf" outputDescription="PDF"/> diff --git a/fj-doc-maven-plugin/src/main/resources/config/template/flavour/openliberty/DocResource.ftl b/fj-doc-maven-plugin/src/main/resources/config/template/flavour/openliberty/DocResource.ftl index 0c0a83067..a45ccb523 100644 --- a/fj-doc-maven-plugin/src/main/resources/config/template/flavour/openliberty/DocResource.ftl +++ b/fj-doc-maven-plugin/src/main/resources/config/template/flavour/openliberty/DocResource.ftl @@ -29,6 +29,10 @@ public class DocResource { <@fhm.createQuarkusPath context=context outputMime="text/html" outputExtension="html" outputDescription="HTML"/> + <#if context.asciidocFreemarkerHandlerAvailable> + <@fhm.createQuarkusPath context=context outputMime="text/asciidoc" outputExtension="adoc" outputDescription="AsciiDoc"/> + + <#if context.modules?seq_contains("fj-doc-mod-fop")> <@fhm.createQuarkusPath context=context outputMime="application/pdf" outputExtension="pdf" outputDescription="PDF"/> diff --git a/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-2/DocResource.ftl b/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-2/DocResource.ftl index bd53c3703..de5878fa1 100644 --- a/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-2/DocResource.ftl +++ b/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-2/DocResource.ftl @@ -29,6 +29,10 @@ public class DocResource { <@fhm.createQuarkusPath context=context outputMime="text/html" outputExtension="html" outputDescription="HTML"/> + <#if context.asciidocFreemarkerHandlerAvailable> + <@fhm.createQuarkusPath context=context outputMime="text/asciidoc" outputExtension="adoc" outputDescription="AsciiDoc"/> + + <#if context.modules?seq_contains("fj-doc-mod-fop")> <@fhm.createQuarkusPath context=context outputMime="application/pdf" outputExtension="pdf" outputDescription="PDF"/> diff --git a/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-2/DocResourceTest.ftl b/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-2/DocResourceTest.ftl index 46ba44e6e..52a5ed759 100644 --- a/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-2/DocResourceTest.ftl +++ b/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-2/DocResourceTest.ftl @@ -20,6 +20,13 @@ class DocResourceTest { given().when().get("/doc/example.html").then().statusCode(200); } + <#if context.asciidocFreemarkerHandlerAvailable> + @Test + void testAsciiDoc() { + given().when().get("/doc/example.adoc").then().statusCode(200); + } + + <#if context.modules?seq_contains("fj-doc-mod-fop")> @Test void testPdf() { diff --git a/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-3/DocResource.ftl b/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-3/DocResource.ftl index 0c0a83067..a45ccb523 100644 --- a/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-3/DocResource.ftl +++ b/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-3/DocResource.ftl @@ -29,6 +29,10 @@ public class DocResource { <@fhm.createQuarkusPath context=context outputMime="text/html" outputExtension="html" outputDescription="HTML"/> + <#if context.asciidocFreemarkerHandlerAvailable> + <@fhm.createQuarkusPath context=context outputMime="text/asciidoc" outputExtension="adoc" outputDescription="AsciiDoc"/> + + <#if context.modules?seq_contains("fj-doc-mod-fop")> <@fhm.createQuarkusPath context=context outputMime="application/pdf" outputExtension="pdf" outputDescription="PDF"/> diff --git a/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-3/DocResourceTest.ftl b/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-3/DocResourceTest.ftl index 46ba44e6e..52a5ed759 100644 --- a/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-3/DocResourceTest.ftl +++ b/fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-3/DocResourceTest.ftl @@ -20,6 +20,13 @@ class DocResourceTest { given().when().get("/doc/example.html").then().statusCode(200); } + <#if context.asciidocFreemarkerHandlerAvailable> + @Test + void testAsciiDoc() { + given().when().get("/doc/example.adoc").then().statusCode(200); + } + + <#if context.modules?seq_contains("fj-doc-mod-fop")> @Test void testPdf() { diff --git a/fj-doc-maven-plugin/src/main/resources/config/template/flavour/springboot-3/DocController.ftl b/fj-doc-maven-plugin/src/main/resources/config/template/flavour/springboot-3/DocController.ftl index 86876b6ee..f2f4050f0 100644 --- a/fj-doc-maven-plugin/src/main/resources/config/template/flavour/springboot-3/DocController.ftl +++ b/fj-doc-maven-plugin/src/main/resources/config/template/flavour/springboot-3/DocController.ftl @@ -30,7 +30,11 @@ public class DocController { <@fhm.createSpringBootPath context=context outputMime="text/markdown" outputExtension="md" outputDescription="Markdown"/> <@fhm.createSpringBootPath context=context outputMime="text/html" outputExtension="html" outputDescription="HTML"/> - + + <#if context.asciidocFreemarkerHandlerAvailable> + <@fhm.createSpringBootPath context=context outputMime="text/asciidoc" outputExtension="adoc" outputDescription="AsciiDoc"/> + + <#if context.modules?seq_contains("fj-doc-mod-fop")> <@fhm.createSpringBootPath context=context outputMime="application/pdf" outputExtension="pdf" outputDescription="PDF"/> diff --git a/fj-doc-maven-plugin/src/main/resources/config/template/fm-doc-process-config-template.ftl b/fj-doc-maven-plugin/src/main/resources/config/template/fm-doc-process-config-template.ftl index 852f9efa6..0502111dd 100644 --- a/fj-doc-maven-plugin/src/main/resources/config/template/fm-doc-process-config-template.ftl +++ b/fj-doc-maven-plugin/src/main/resources/config/template/fm-doc-process-config-template.ftl @@ -23,6 +23,10 @@ + <#if context.asciidocFreemarkerHandlerAvailable> + + + <#if context.modules?seq_contains("fj-doc-mod-fop")>