Skip to content

Commit e439c6f

Browse files
authored
Ensure that old-style object description options are respected (#12620)
1 parent 587da41 commit e439c6f

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Bugs fixed
66

77
* #12096: Warn when files are overwritten in the build directory.
88
Patch by Adam Turner.
9+
* #12620: Ensure that old-style object description options are respected.
10+
Patch by Adam Turner.
911

1012
Release 7.4.6 (released Jul 18, 2024)
1113
=====================================

sphinx/directives/__init__.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,21 +220,26 @@ def run(self) -> list[Node]:
220220
node['domain'] = self.domain
221221
# 'desctype' is a backwards compatible attribute
222222
node['objtype'] = node['desctype'] = self.objtype
223+
224+
# Copy old option names to new ones
225+
# xref RemovedInSphinx90Warning
226+
# deprecate noindex, noindexentry, and nocontentsentry in Sphinx 9.0
227+
if 'no-index' not in self.options and 'noindex' in self.options:
228+
self.options['no-index'] = self.options['noindex']
229+
if 'no-index-entry' not in self.options and 'noindexentry' in self.options:
230+
self.options['no-index-entry'] = self.options['noindexentry']
231+
if 'no-contents-entry' not in self.options and 'nocontentsentry' in self.options:
232+
self.options['no-contents-entry'] = self.options['nocontentsentry']
233+
223234
node['no-index'] = node['noindex'] = no_index = (
224235
'no-index' in self.options
225-
# xref RemovedInSphinx90Warning
226-
# deprecate noindex in Sphinx 9.0
227-
or 'noindex' in self.options)
236+
)
228237
node['no-index-entry'] = node['noindexentry'] = (
229238
'no-index-entry' in self.options
230-
# xref RemovedInSphinx90Warning
231-
# deprecate noindexentry in Sphinx 9.0
232-
or 'noindexentry' in self.options)
239+
)
233240
node['no-contents-entry'] = node['nocontentsentry'] = (
234241
'no-contents-entry' in self.options
235-
# xref RemovedInSphinx90Warning
236-
# deprecate nocontentsentry in Sphinx 9.0
237-
or 'nocontentsentry' in self.options)
242+
)
238243
node['no-typesetting'] = ('no-typesetting' in self.options)
239244
if self.domain:
240245
node['classes'].append(self.domain)

sphinx/domains/javascript.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ class JSModule(SphinxDirective):
309309
def run(self) -> list[Node]:
310310
mod_name = self.arguments[0].strip()
311311
self.env.ref_context['js:module'] = mod_name
312-
no_index = 'no-index' in self.options or 'noindex' in self.options
312+
no_index = 'no-index' in self.options
313313

314314
content_nodes = self.parse_content_to_nodes(allow_section_headings=True)
315315

sphinx/domains/python/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def run(self) -> list[Node]:
452452
domain = cast(PythonDomain, self.env.get_domain('py'))
453453

454454
modname = self.arguments[0].strip()
455-
no_index = 'no-index' in self.options or 'noindex' in self.options
455+
no_index = 'no-index' in self.options
456456
self.env.ref_context['py:module'] = modname
457457

458458
content_nodes = self.parse_content_to_nodes(allow_section_headings=True)

0 commit comments

Comments
 (0)