Ensure that old-style object description options are respected (#12620)

This commit is contained in:
Adam Turner
2024-07-19 08:38:52 +01:00
committed by GitHub
parent 587da413ca
commit e439c6f33f
4 changed files with 18 additions and 11 deletions

View File

@@ -6,6 +6,8 @@ Bugs fixed
* #12096: Warn when files are overwritten in the build directory.
Patch by Adam Turner.
* #12620: Ensure that old-style object description options are respected.
Patch by Adam Turner.
Release 7.4.6 (released Jul 18, 2024)
=====================================

View File

@@ -220,21 +220,26 @@ class ObjectDescription(SphinxDirective, Generic[ObjDescT]):
node['domain'] = self.domain
# 'desctype' is a backwards compatible attribute
node['objtype'] = node['desctype'] = self.objtype
# Copy old option names to new ones
# xref RemovedInSphinx90Warning
# deprecate noindex, noindexentry, and nocontentsentry in Sphinx 9.0
if 'no-index' not in self.options and 'noindex' in self.options:
self.options['no-index'] = self.options['noindex']
if 'no-index-entry' not in self.options and 'noindexentry' in self.options:
self.options['no-index-entry'] = self.options['noindexentry']
if 'no-contents-entry' not in self.options and 'nocontentsentry' in self.options:
self.options['no-contents-entry'] = self.options['nocontentsentry']
node['no-index'] = node['noindex'] = no_index = (
'no-index' in self.options
# xref RemovedInSphinx90Warning
# deprecate noindex in Sphinx 9.0
or 'noindex' in self.options)
)
node['no-index-entry'] = node['noindexentry'] = (
'no-index-entry' in self.options
# xref RemovedInSphinx90Warning
# deprecate noindexentry in Sphinx 9.0
or 'noindexentry' in self.options)
)
node['no-contents-entry'] = node['nocontentsentry'] = (
'no-contents-entry' in self.options
# xref RemovedInSphinx90Warning
# deprecate nocontentsentry in Sphinx 9.0
or 'nocontentsentry' in self.options)
)
node['no-typesetting'] = ('no-typesetting' in self.options)
if self.domain:
node['classes'].append(self.domain)

View File

@@ -309,7 +309,7 @@ class JSModule(SphinxDirective):
def run(self) -> list[Node]:
mod_name = self.arguments[0].strip()
self.env.ref_context['js:module'] = mod_name
no_index = 'no-index' in self.options or 'noindex' in self.options
no_index = 'no-index' in self.options
content_nodes = self.parse_content_to_nodes(allow_section_headings=True)

View File

@@ -452,7 +452,7 @@ class PyModule(SphinxDirective):
domain = cast(PythonDomain, self.env.get_domain('py'))
modname = self.arguments[0].strip()
no_index = 'no-index' in self.options or 'noindex' in self.options
no_index = 'no-index' in self.options
self.env.ref_context['py:module'] = modname
content_nodes = self.parse_content_to_nodes(allow_section_headings=True)