cmRST: Add missing roles

Our Sphinx extensions recognize several roles that missed being added to
our internal C++ parser (`cmRST`). Update the latter with the missing
roles, bringing the two back in sync. This addresses several roles that
`cmRST` was previously leaving as inline markup that more appropriately
should be converted to literal text.
This commit is contained in:
Matthew Woehlke
2026-07-29 15:00:40 -04:00
parent 42da7a30a9
commit a9e89fec6d
4 changed files with 62 additions and 4 deletions
+6 -4
View File
@@ -34,11 +34,13 @@ cmRST::cmRST(std::ostream& os, std::string docroot)
, ModuleRST(R"(^#\[(=*)\[\.rst:$)")
, CMakeRole("(:cmake)?:("
"cref|"
"command|cpack_gen|diagnostic|generator|genex|"
"variable|envvar|module|policy|"
"prop_cache|prop_dir|prop_gbl|prop_inst|prop_sf|"
"program|command|cpack_gen|diagnostic|envvar|generator|genex|"
"manual|module|policy|preset|variable|"
"prop_cache|prop_dir|prop_fs|prop_gbl|prop_inst|prop_sf|"
"prop_test|prop_tgt|"
"manual"
"option|cmake-option|cmake-build-option|cmake-install-option|"
"cmake-workflow-option|cpack-option|ctest-option|"
"ctest-dashboard-option"
"):`(<*([^`<]|[^` \t]<)*)([ \t]+<[^`]*>)?`")
, InlineLink("`(<*([^`<]|[^` \t]<)*)([ \t]+<[^`]*>)?`_")
, InlineLiteral("``([^`]*)``")
+27
View File
@@ -36,6 +36,33 @@ Inline link Link Text <With \-escaped Brackets>.
Inline literal ``__`` followed by inline link Link Text.
Inline literal ``~!@#$%^&*( )_+-=\\[]{}'":;,<>.?/``.
Try running ``cmake``.
Enable ``CMD_AUTHOR`` warnings with ``-Wauthor``,
or with the ``configurePresets.warnings.author`` preset field.
Read the ``cmake(1)`` manual.
Learn about the ``GNUInstallDirs`` module.
Policy ``CMP9999`` doesn't exist. (Yet?)
Some properties that don't exist:
- ``NO_SUCH_CACHE_PROPERTY``
- ``NO_SUCH_DIRECTORY_PROPERTY``
- ``NO_SUCH_FILESET_PROPERTY``
- ``NO_SUCH_GLOBAL_PROPERTY``
- ``NO_SUCH_INSTALL_PROPERTY``
- ``NO_SUCH_SOURCE_FILE_PROPERTY``
- ``NO_SUCH_TEST_PROPERTY``
- ``NO_SUCH_TARGET_PROPERTY``
Various ways to reference command-line options:
- ``cmake --build \<dir\>``
- ``--log-level``
- ``--parallel``
- ``--config``
- ``--preset``
- ``-G``
- ``--parallel``
- ``--build-dir``
First TOC entry.
|not replaced|
+27
View File
@@ -43,6 +43,33 @@ Inline link `Link Text \<With \\-escaped Brackets\> <ExternalDest>`_.
Inline literal ``__`` followed by inline link `Link Text <InternalDest_>`_.
Inline literal ``~!@#$%^&*( )_+-=\\[]{}'":;,<>.?/``.
Try running :program:`cmake`.
Enable :diagnostic:`CMD_AUTHOR` warnings with :cmake-option:`-Wauthor`,
or with the :preset:`configurePresets.warnings.author` preset field.
Read the :manual:`cmake(1)` manual.
Learn about the :module:`GNUInstallDirs` module.
Policy :policy:`CMP9999` doesn't exist. (Yet?)
Some properties that don't exist:
- :prop_cache:`NO_SUCH_CACHE_PROPERTY`
- :prop_dir:`NO_SUCH_DIRECTORY_PROPERTY`
- :prop_fs:`NO_SUCH_FILESET_PROPERTY`
- :prop_gbl:`NO_SUCH_GLOBAL_PROPERTY`
- :prop_inst:`NO_SUCH_INSTALL_PROPERTY`
- :prop_sf:`NO_SUCH_SOURCE_FILE_PROPERTY`
- :prop_test:`NO_SUCH_TEST_PROPERTY`
- :prop_tgt:`NO_SUCH_TARGET_PROPERTY`
Various ways to reference command-line options:
- :option:`cmake --build \<dir\> <cmake --build>`
- :cmake-option:`--log-level`
- :cmake-build-option:`--parallel`
- :cmake-install-option:`--config`
- :cmake-workflow-option:`--preset`
- :cpack-option:`-G`
- :ctest-option:`--parallel`
- :ctest-dashboard-option:`--build-dir`
.. |not replaced| replace:: not replaced through toctree
.. |not replaced in literal| replace:: replaced in parsed literal
+2
View File
@@ -790,6 +790,8 @@ class CMakeDomain(Domain):
# Other `object_types` cannot be created except by the `CMakeTransform`
}
roles = {
# NOTE: When adding roles here, consider whether cmRST should also be
# updated.
# General CMake reference roles.
'cref': CMakeCRefRole(),
'command': CMakeXRefRole(fix_parens=True, lowercase=True),