mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
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>
This commit is contained in:
parent
19ca114645
commit
9148c0d893
2 changed files with 17 additions and 0 deletions
15
Doc/conf.py
15
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue