Skip to content

Commit

Permalink
Ensure that old-style object description options are respected (#12620)
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jul 19, 2024
1 parent 587da41 commit e439c6f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
=====================================
Expand Down
23 changes: 14 additions & 9 deletions sphinx/directives/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,21 +220,26 @@ def run(self) -> list[Node]:
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)
Expand Down
2 changes: 1 addition & 1 deletion sphinx/domains/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion sphinx/domains/python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def run(self) -> list[Node]:
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)
Expand Down

0 comments on commit e439c6f

Please sign in to comment.