Skip to content

Commit

Permalink
gh-97740: Fix bang in Sphinx C domain ref target syntax (GH-97741)
Browse files Browse the repository at this point in the history
* gh-97740: Fix bang in Sphinx C domain ref target syntax

Co-authored-by: Adam Turner <[email protected]>

* Add NEWS entry for C domain bang fix

Co-authored-by: Adam Turner <[email protected]>
(cherry picked from commit 9148c0d)

Co-authored-by: C.A.M. Gerlach <[email protected]>
  • Loading branch information
miss-islington and CAM-Gerlach authored Oct 3, 2022
1 parent c2d3f73 commit a1711ef
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit a1711ef

Please sign in to comment.