Merge pull request #7352 from tk0miya/refactor_autosummary

Deprecate sphinx.ext.autosummary:process_autosummary_toc()
This commit is contained in:
Takeshi KOMIYA 2020-03-22 17:41:33 +09:00 committed by GitHub
commit a6c1cc2ace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View File

@ -54,6 +54,7 @@ Deprecated
* ``sphinx.domains.std.StandardDomain.add_object()`` * ``sphinx.domains.std.StandardDomain.add_object()``
* ``sphinx.domains.python.PyDecoratorMixin`` * ``sphinx.domains.python.PyDecoratorMixin``
* ``sphinx.ext.autodoc.get_documenters()`` * ``sphinx.ext.autodoc.get_documenters()``
* ``sphinx.ext.autosummary.process_autosummary_toc()``
* ``sphinx.parsers.Parser.app`` * ``sphinx.parsers.Parser.app``
* ``sphinx.testing.path.Path.text()`` * ``sphinx.testing.path.Path.text()``
* ``sphinx.testing.path.Path.bytes()`` * ``sphinx.testing.path.Path.bytes()``

View File

@ -51,6 +51,11 @@ The following is a list of deprecated interfaces.
- 5.0 - 5.0
- ``sphinx.registry.documenters`` - ``sphinx.registry.documenters``
* - ``sphinx.ext.autosummary.process_autosummary_toc()``
- 3.0
- 5.0
- N/A
* - ``sphinx.parsers.Parser.app`` * - ``sphinx.parsers.Parser.app``
- 3.0 - 3.0
- 5.0 - 5.0

View File

@ -72,7 +72,7 @@ from docutils.statemachine import StringList
import sphinx import sphinx
from sphinx import addnodes from sphinx import addnodes
from sphinx.application import Sphinx from sphinx.application import Sphinx
from sphinx.deprecation import RemovedInSphinx40Warning from sphinx.deprecation import RemovedInSphinx40Warning, RemovedInSphinx50Warning
from sphinx.environment import BuildEnvironment from sphinx.environment import BuildEnvironment
from sphinx.environment.adapters.toctree import TocTree from sphinx.environment.adapters.toctree import TocTree
from sphinx.ext.autodoc import Documenter from sphinx.ext.autodoc import Documenter
@ -110,6 +110,8 @@ def process_autosummary_toc(app: Sphinx, doctree: nodes.document) -> None:
"""Insert items described in autosummary:: to the TOC tree, but do """Insert items described in autosummary:: to the TOC tree, but do
not generate the toctree:: list. not generate the toctree:: list.
""" """
warnings.warn('process_autosummary_toc() is deprecated',
RemovedInSphinx50Warning, stacklevel=2)
env = app.builder.env env = app.builder.env
crawled = {} crawled = {}
@ -766,7 +768,6 @@ def setup(app: Sphinx) -> Dict[str, Any]:
texinfo=(autosummary_noop, autosummary_noop)) texinfo=(autosummary_noop, autosummary_noop))
app.add_directive('autosummary', Autosummary) app.add_directive('autosummary', Autosummary)
app.add_role('autolink', AutoLink()) app.add_role('autolink', AutoLink())
app.connect('doctree-read', process_autosummary_toc)
app.connect('builder-inited', process_generate_options) app.connect('builder-inited', process_generate_options)
app.add_config_value('autosummary_generate', [], True, [bool]) app.add_config_value('autosummary_generate', [], True, [bool])
app.add_config_value('autosummary_generate_overwrite', True, False) app.add_config_value('autosummary_generate_overwrite', True, False)