Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.7.2 backports 2 #38661

Merged
merged 11 commits into from
Feb 8, 2024
Prev Previous commit
Replace [#anchors] with [[anchors]] in downstream documentation
(cherry picked from commit cdd343f)
  • Loading branch information
gsmet committed Feb 7, 2024
commit 7f77c9b46dfc4c27d94ecf1145fb683a6bf64250
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public class AssembleDownstreamDocumentation {
Pattern.CASE_INSENSITIVE);
private static final Pattern ANGLE_BRACKETS_WITH_DESCRIPTION_PATTERN = Pattern.compile("<<([a-z0-9_\\-#\\.]+?),([^>]+?)>>",
Pattern.CASE_INSENSITIVE);
private static final Pattern ANCHOR_PATTERN = Pattern.compile("^\\[#([a-z0-9_-]+)]$",
Pattern.CASE_INSENSITIVE + Pattern.MULTILINE);
private static final String SOURCE_BLOCK_PREFIX = "[source";
private static final String SOURCE_BLOCK_DELIMITER = "--";

Expand Down Expand Up @@ -448,6 +450,10 @@ private static String rewriteLinks(String fileName,
return "link:" + QUARKUS_IO_GUIDES_ATTRIBUTE + "/" + mr.group(1);
});

content = ANCHOR_PATTERN.matcher(content).replaceAll(mr -> {
return "[[" + mr.group(1) + "]]";
});

return content;
}

Expand Down
Loading