From 2b8bd8356989e4349c9570a006ae2f1506834920 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Sat, 10 Aug 2024 18:09:57 +0200 Subject: [PATCH] Config Doc - Disable enum tooltips by default There is a good chance we don't have them working in the Quarkiverse doc so let's be cautious. --- .../io/quarkus/maven/config/doc/AsciidocFormatter.java | 8 +++++--- .../io/quarkus/maven/config/doc/GenerateAsciidocMojo.java | 5 ++++- docs/pom.xml | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/AsciidocFormatter.java b/devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/AsciidocFormatter.java index 7baf92dc734f3..211e27875de24 100644 --- a/devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/AsciidocFormatter.java +++ b/devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/AsciidocFormatter.java @@ -18,9 +18,11 @@ final class AsciidocFormatter { private static final String MORE_INFO_ABOUT_TYPE_FORMAT = "link:#%s[icon:question-circle[title=More information about the %s format]]"; private final JavadocRepository javadocRepository; + private final boolean enableEnumTooltips; - AsciidocFormatter(JavadocRepository javadocRepository) { + AsciidocFormatter(JavadocRepository javadocRepository, boolean enableEnumTooltips) { this.javadocRepository = javadocRepository; + this.enableEnumTooltips = enableEnumTooltips; } String formatDescription(ConfigProperty configProperty) { @@ -42,7 +44,7 @@ String formatDescription(ConfigProperty configProperty) { String formatTypeDescription(ConfigProperty configProperty) { String typeContent = ""; - if (configProperty.isEnum()) { + if (configProperty.isEnum() && enableEnumTooltips) { typeContent = configProperty.getEnumAcceptedValues().values().entrySet().stream() .map(e -> { Optional javadocElement = javadocRepository.getElement(configProperty.getType(), @@ -83,7 +85,7 @@ String formatDefaultValue(ConfigProperty configProperty) { return null; } - if (configProperty.isEnum()) { + if (configProperty.isEnum() && enableEnumTooltips) { Optional enumConstant = configProperty.getEnumAcceptedValues().values().entrySet().stream() .filter(e -> e.getValue().configValue().equals(defaultValue)) .map(e -> e.getKey()) diff --git a/devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/GenerateAsciidocMojo.java b/devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/GenerateAsciidocMojo.java index 06ec52ba4afe1..bd9c3c74aadba 100644 --- a/devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/GenerateAsciidocMojo.java +++ b/devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/GenerateAsciidocMojo.java @@ -61,6 +61,9 @@ public class GenerateAsciidocMojo extends AbstractMojo { @Parameter(defaultValue = "false") private boolean generateAllConfig; + @Parameter(defaultValue = "false") + private boolean enableEnumTooltips; + @Parameter(defaultValue = "false") private boolean skip; @@ -81,7 +84,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { JavadocRepository javadocRepository = JavadocMerger.mergeJavadocElements(targetDirectories); MergedModel mergedModel = ModelMerger.mergeModel(targetDirectories); - AsciidocFormatter asciidocFormatter = new AsciidocFormatter(javadocRepository); + AsciidocFormatter asciidocFormatter = new AsciidocFormatter(javadocRepository, enableEnumTooltips); Engine quteEngine = initializeQuteEngine(asciidocFormatter); // we generate a file per extension + top level prefix diff --git a/docs/pom.xml b/docs/pom.xml index da9bc9f05edeb..5201246f04796 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -3189,6 +3189,7 @@ ${skipDocs} true + true