From 64cbbd7881698665698d5a402d5d46fd42bf58b5 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Sun, 2 Oct 2022 22:51:22 -0500 Subject: [PATCH] gh-97740: Fix bang in Sphinx C domain ref target syntax (GH-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> (cherry picked from commit 9148c0d893c7807331fd7be0997261e289074bc5) Co-authored-by: C.A.M. Gerlach --- Doc/conf.py | 15 +++++++++++++++ .../2022-10-02-10-58-52.gh-issue-97741.39l023.rst | 2 ++ 2 files changed, 17 insertions(+) create mode 100644 Misc/NEWS.d/next/Documentation/2022-10-02-10-58-52.gh-issue-97741.39l023.rst diff --git a/Doc/conf.py b/Doc/conf.py index 2e670e5a8569df..e5c989da0b360d 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -244,3 +244,18 @@ # 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 00000000000000..8da9c92f6fd879 --- /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. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy