Skip to content

Commit

Permalink
Config Doc - Disable enum tooltips by default
Browse files Browse the repository at this point in the history
There is a good chance we don't have them working in the Quarkiverse doc
so let's be cautious.
  • Loading branch information
gsmet committed Aug 10, 2024
1 parent 036b79b commit 2b8bd83
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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> javadocElement = javadocRepository.getElement(configProperty.getType(),
Expand Down Expand Up @@ -83,7 +85,7 @@ String formatDefaultValue(ConfigProperty configProperty) {
return null;
}

if (configProperty.isEnum()) {
if (configProperty.isEnum() && enableEnumTooltips) {
Optional<String> enumConstant = configProperty.getEnumAcceptedValues().values().entrySet().stream()
.filter(e -> e.getValue().configValue().equals(defaultValue))
.map(e -> e.getKey())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3189,6 +3189,7 @@
<configuration>
<skip>${skipDocs}</skip>
<generateAllConfig>true</generateAllConfig>
<enableEnumTooltips>true</enableEnumTooltips>
</configuration>
</execution>
</executions>
Expand Down

0 comments on commit 2b8bd83

Please sign in to comment.