Skip to content

Commit

Permalink
Split the possible config values into multiple lines
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartisk authored and bschuhmann committed Nov 16, 2024
1 parent 3aadc8f commit f2a4885
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f2a4885

Please sign in to comment.