From 9ed206876f494c1a5692ff9b9b63f91e42b1745f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 4 Sep 2026 20:02:31 -0400 Subject: [PATCH 1/2] testRST: add test cases for anonymous hyperlinks These links have two underscores after the ticks. --- Tests/CMakeLib/testRST.expect | 3 +++ Tests/CMakeLib/testRST.rst | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Tests/CMakeLib/testRST.expect b/Tests/CMakeLib/testRST.expect index 1f33ae0ba2..5553dad2cd 100644 --- a/Tests/CMakeLib/testRST.expect +++ b/Tests/CMakeLib/testRST.expect @@ -33,6 +33,9 @@ Inline cref ``Link_Text_``. Inline link Link Dest. Inline link Link Text. Inline link Link Text . +Inline link anon Link Dest. +Inline link anon Link Text. +Inline link anon Link Text . Inline literal ``__`` followed by inline link Link Text. Inline literal ``~!@#$%^&*( )_+-=\\[]{}'":;,<>.?/``. diff --git a/Tests/CMakeLib/testRST.rst b/Tests/CMakeLib/testRST.rst index f8e55bccf1..e10cd63936 100644 --- a/Tests/CMakeLib/testRST.rst +++ b/Tests/CMakeLib/testRST.rst @@ -40,6 +40,9 @@ Inline cref :cref:`Link_Text_ `. Inline link `Link Dest`_. Inline link `Link Text `_. Inline link `Link Text \ `_. +Inline link anon `Link Dest`__. +Inline link anon `Link Text `__. +Inline link anon `Link Text \ `__. Inline literal ``__`` followed by inline link `Link Text `_. Inline literal ``~!@#$%^&*( )_+-=\\[]{}'":;,<>.?/``. From 119b2e62f88a71df7c0da637b16255d39ab6591c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 4 Sep 2026 20:02:58 -0400 Subject: [PATCH 2/2] cmRST: match anonymous hyperlink syntax Previously, the `cmake --help-command string` output would have an extra trailing `_` after `string(JSON)` subcommand names because they are anonymous hyperlinks in the source. Support matching a double underscore so that it is removed in the `--help-*` output. --- Source/cmRST.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index f931f48c80..c1c0b68b1c 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -40,7 +40,7 @@ cmRST::cmRST(std::string docroot) "cmake-workflow-option|cpack-option|ctest-option|" "ctest-dashboard-option" "):`(<*([^`<]|[^` \t]<)*)([ \t]+<[^`]*>)?`") - , InlineLink("`(<*([^`<]|[^` \t]<)*)([ \t]+<[^`]*>)?`_") + , InlineLink("`(<*([^`<]|[^` \t]<)*)([ \t]+<[^`]*>)?`__?") , InlineLiteral("``([^`]*)``") , Substitution("(^|[^A-Za-z0-9_])" "((\\|[^| \t\r\n]([^|\r\n]*[^| \t\r\n])?\\|)(__|_|))"