Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
# Avoid a warning with Sphinx >= 2.0
master_doc = 'contents'

# Allow translation of index directives
gettext_additional_targets = [
'index',
]

# Options for HTML output
# -----------------------

Expand Down
24 changes: 24 additions & 0 deletions Doc/tools/extensions/pyspecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,29 @@ def process_audit_events(app, doctree, fromdocname):
node.replace_self(table)


def patch_pairindextypes(app) -> None:
if app.builder.name != 'gettext':
return

# allow translating deprecated index entries
try:
from sphinx.domains.python import pairindextypes
except ImportError:
pass
else:
# pairindextypes.pop('module', None)
# pairindextypes.pop('keyword', None)
# pairindextypes.pop('operator', None)
# pairindextypes.pop('object', None)
# pairindextypes.pop('exception', None)
# pairindextypes.pop('statement', None)
# pairindextypes.pop('builtin', None)

# there needs to be at least one statement in this block, will be
# removed when the first of the below is uncommented.
pass


def setup(app):
app.add_role('issue', issue_role)
app.add_role('gh', gh_issue_role)
Expand All @@ -695,6 +718,7 @@ def setup(app):
app.add_directive_to_domain('py', 'awaitablemethod', PyAwaitableMethod)
app.add_directive_to_domain('py', 'abstractmethod', PyAbstractMethod)
app.add_directive('miscnews', MiscNews)
app.connect('builder-inited', patch_pairindextypes)
app.connect('doctree-resolved', process_audit_events)
app.connect('env-merge-info', audit_events_merge)
app.connect('env-purge-doc', audit_events_purge)
Expand Down