Skip to content

Restore 'noindex' support for JS, Python domains #12844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ Bugs fixed
* #12796: Enable parallel reading if requested,
even if there are fewer than 6 documents.
Patch by Matthias Geier.

* #12844: Restore support for ``:noindex:`` for the :rst:dir:`js:module`
and :rst:dir:`py:module` directives.
Patch by Stephen Finucane.

Testing
-------
Expand Down
6 changes: 6 additions & 0 deletions sphinx/domains/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ class JSModule(SphinxDirective):
}

def run(self) -> list[Node]:
# Copy old option names to new ones
# xref RemovedInSphinx90Warning
# # deprecate noindex in Sphinx 9.0
if 'no-index' not in self.options and 'noindex' in self.options:
self.options['no-index'] = self.options['noindex']

mod_name = self.arguments[0].strip()
self.env.ref_context['js:module'] = mod_name
no_index = 'no-index' in self.options
Expand Down
6 changes: 6 additions & 0 deletions sphinx/domains/python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,12 @@ class PyModule(SphinxDirective):
}

def run(self) -> list[Node]:
# Copy old option names to new ones
# xref RemovedInSphinx90Warning
# # deprecate noindex in Sphinx 9.0
if 'no-index' not in self.options and 'noindex' in self.options:
self.options['no-index'] = self.options['noindex']

domain = cast(PythonDomain, self.env.get_domain('py'))

modname = self.arguments[0].strip()
Expand Down