From 037304d51af31baae5a5c4012ce2fe30edc4dbe6 Mon Sep 17 00:00:00 2001 From: Jan Martiska Date: Thu, 24 Oct 2024 10:52:56 +0200 Subject: [PATCH 1/3] Unwrap tooltips in the downstream configuration reference docs --- .../docs/generation/AssembleDownstreamDocumentation.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java b/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java index f87a9763c1238..db83e3f63e0c6 100755 --- a/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java +++ b/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java @@ -62,6 +62,7 @@ public class AssembleDownstreamDocumentation { private static final String SOURCE_BLOCK_PREFIX = "[source"; private static final String SOURCE_BLOCK_DELIMITER = "--"; private static final Pattern FOOTNOTE_PATTERN = Pattern.compile("footnote:([a-z0-9_-]+)\\[(\\])?"); + private static final Pattern TOOLTIP_PATTERN = Pattern.compile("tooltip:([a-z0-9_-]+)\\[(.*?)\\]"); private static final String PROJECT_NAME_ATTRIBUTE = "{project-name}"; private static final String RED_HAT_BUILD_OF_QUARKUS = "Red Hat build of Quarkus"; @@ -483,6 +484,10 @@ private static String rewriteContent(String fileName, return "footnoteref:[" + mr.group(1) + ", "; }); + content = TOOLTIP_PATTERN.matcher(content).replaceAll(mr -> { + return "*" + mr.group(1) + "*: " + mr.group(2); + }); + return content; } From aba8880f91c94473ea92fbc11e658f3afea8cca8 Mon Sep 17 00:00:00 2001 From: Jan Martiska Date: Thu, 24 Oct 2024 13:03:28 +0200 Subject: [PATCH 2/3] Split the possible config values into multiple lines --- .../generation/AssembleDownstreamDocumentation.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java b/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java index db83e3f63e0c6..61ce61b71c4af 100755 --- a/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java +++ b/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java @@ -62,7 +62,7 @@ public class AssembleDownstreamDocumentation { private static final String SOURCE_BLOCK_PREFIX = "[source"; private static final String SOURCE_BLOCK_DELIMITER = "--"; private static final Pattern FOOTNOTE_PATTERN = Pattern.compile("footnote:([a-z0-9_-]+)\\[(\\])?"); - private static final Pattern TOOLTIP_PATTERN = Pattern.compile("tooltip:([a-z0-9_-]+)\\[(.*?)\\]"); + private static final Pattern TOOLTIP_PATTERN = Pattern.compile("tooltip:([a-z0-9_-]+)\\[(.*?)\\](, ?)?"); private static final String PROJECT_NAME_ATTRIBUTE = "{project-name}"; private static final String RED_HAT_BUILD_OF_QUARKUS = "Red Hat build of Quarkus"; @@ -485,7 +485,14 @@ private static String rewriteContent(String fileName, }); content = TOOLTIP_PATTERN.matcher(content).replaceAll(mr -> { - return "*" + mr.group(1) + "*: " + mr.group(2); + // group(1) is the enum value, group(2) is the tooltip text for the value + if (mr.group(3) != null) { + // group(3) is a comma that means there are still more values after this one + // So in this case, replace it with two newlines to visually separate items + return "*" + mr.group(1) + "*: " + mr.group(2) + "\n\n"; + } else { + return "*" + mr.group(1) + "*: " + mr.group(2); + } }); return content; From 3912bb159a342beaed854819accd7a8a8dc4cfa1 Mon Sep 17 00:00:00 2001 From: Jan Martiska Date: Tue, 29 Oct 2024 15:35:33 +0100 Subject: [PATCH 3/3] For the third column (property default value), skip the description --- .../generation/AssembleDownstreamDocumentation.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java b/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java index 61ce61b71c4af..16531c4889452 100755 --- a/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java +++ b/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java @@ -62,7 +62,14 @@ public class AssembleDownstreamDocumentation { private static final String SOURCE_BLOCK_PREFIX = "[source"; private static final String SOURCE_BLOCK_DELIMITER = "--"; private static final Pattern FOOTNOTE_PATTERN = Pattern.compile("footnote:([a-z0-9_-]+)\\[(\\])?"); + private static final Pattern TOOLTIP_PATTERN = Pattern.compile("tooltip:([a-z0-9_-]+)\\[(.*?)\\](, ?)?"); + // A tooltip that is detected to be in the third column of a configuration reference table + // (a default value for a configuration property) - in this case, let's strip out the description from it. + // We assume it's in the third column if it follows right after a | at the beginning of a line (if it's in + // the second column, it would be preceded by a|, not just |). + private static final Pattern TOOLTIP_PATTERN_DEFAULT_COLUMN = Pattern.compile("^\\|tooltip:([a-z0-9_-]+)\\[(.*?)\\](, ?)?", + Pattern.MULTILINE); private static final String PROJECT_NAME_ATTRIBUTE = "{project-name}"; private static final String RED_HAT_BUILD_OF_QUARKUS = "Red Hat build of Quarkus"; @@ -484,6 +491,12 @@ private static String rewriteContent(String fileName, return "footnoteref:[" + mr.group(1) + ", "; }); + content = TOOLTIP_PATTERN_DEFAULT_COLUMN.matcher(content).replaceAll(mr -> { + // for tooltips in the third column of the configuration reference table (the default values), + // don't include the description, just the plain value + return "|*" + mr.group(1) + "*"; + }); + content = TOOLTIP_PATTERN.matcher(content).replaceAll(mr -> { // group(1) is the enum value, group(2) is the tooltip text for the value if (mr.group(3) != null) {