diff options
author | C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> | 2022-10-03 03:51:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-03 03:51:22 (GMT) |
commit | 9148c0d893c7807331fd7be0997261e289074bc5 (patch) | |
tree | 96d0ed286443d384d4b1ccb7c148248eacd0a02d | |
parent | 19ca114645bd8796cf4094e152b1fa9944da473d (diff) | |
download | cpython-9148c0d893c7807331fd7be0997261e289074bc5.zip cpython-9148c0d893c7807331fd7be0997261e289074bc5.tar.gz cpython-9148c0d893c7807331fd7be0997261e289074bc5.tar.bz2 |
gh-97740: Fix bang in Sphinx C domain ref target syntax (#97741)
* gh-97740: Fix bang in Sphinx C domain ref target syntax
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* Add NEWS entry for C domain bang fix
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
-rw-r--r-- | Doc/conf.py | 15 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Documentation/2022-10-02-10-58-52.gh-issue-97741.39l023.rst | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/Doc/conf.py b/Doc/conf.py index 0a436d7..909f992 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -249,3 +249,18 @@ c_allow_pre_v3 = True # bpo-40204: Disable warnings on Sphinx 2 syntax of the C domain since the # documentation is built with -W (warnings treated as errors). c_warn_on_allowed_pre_v3 = False + +# Fix '!' not working with C domain when pre_v3 is enabled +import sphinx + +if sphinx.version_info[:2] < (5, 3): + from sphinx.domains.c import CXRefRole + + original_run = CXRefRole.run + + def new_run(self): + if self.disabled: + return super(CXRefRole, self).run() + return original_run(self) + + CXRefRole.run = new_run diff --git a/Misc/NEWS.d/next/Documentation/2022-10-02-10-58-52.gh-issue-97741.39l023.rst b/Misc/NEWS.d/next/Documentation/2022-10-02-10-58-52.gh-issue-97741.39l023.rst new file mode 100644 index 0000000..8da9c92 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2022-10-02-10-58-52.gh-issue-97741.39l023.rst @@ -0,0 +1,2 @@ +Fix ``!`` in c domain ref target syntax via a ``conf.py`` patch, so it works +as intended to disable ref target resolution. |