mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Deprecate sphinx.parsers.Parser.app
This commit is contained in:
parent
f2ec4bfeb7
commit
9409db0771
1
CHANGES
1
CHANGES
@ -28,6 +28,7 @@ Deprecated
|
||||
----------
|
||||
|
||||
* ``sphinx.domains.std.StandardDomain.add_object()``
|
||||
* ``sphinx.parsers.Parser.app``
|
||||
* ``sphinx.testing.path.Path.text()``
|
||||
* ``sphinx.testing.path.Path.bytes()``
|
||||
|
||||
|
@ -31,6 +31,11 @@ The following is a list of deprecated interfaces.
|
||||
- 5.0
|
||||
- ``sphinx.domains.std.StandardDomain.note_object()``
|
||||
|
||||
* - ``sphinx.parsers.Parser.app``
|
||||
- 3.0
|
||||
- 5.0
|
||||
- N/A
|
||||
|
||||
* - ``sphinx.testing.path.Path.text()``
|
||||
- 3.0
|
||||
- 5.0
|
||||
|
@ -8,6 +8,7 @@
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
import warnings
|
||||
from typing import Any, Dict, List, Union
|
||||
|
||||
import docutils.parsers
|
||||
@ -17,6 +18,7 @@ from docutils.parsers.rst import states
|
||||
from docutils.statemachine import StringList
|
||||
from docutils.transforms.universal import SmartQuotes
|
||||
|
||||
from sphinx.deprecation import RemovedInSphinx50Warning
|
||||
from sphinx.util.rst import append_epilog, prepend_prolog
|
||||
|
||||
if False:
|
||||
@ -47,6 +49,8 @@ class Parser(docutils.parsers.Parser):
|
||||
|
||||
.. deprecated:: 1.6
|
||||
``warn()`` and ``info()`` is deprecated. Use :mod:`sphinx.util.logging` instead.
|
||||
.. deprecated:: 3.0
|
||||
parser.app is deprecated.
|
||||
"""
|
||||
|
||||
def set_application(self, app: "Sphinx") -> None:
|
||||
@ -54,10 +58,15 @@ class Parser(docutils.parsers.Parser):
|
||||
|
||||
:param sphinx.application.Sphinx app: Sphinx application object
|
||||
"""
|
||||
self.app = app
|
||||
self._app = app
|
||||
self.config = app.config
|
||||
self.env = app.env
|
||||
|
||||
@property
|
||||
def app(self) -> "Sphinx":
|
||||
warnings.warn('parser.app is deprecated.', RemovedInSphinx50Warning)
|
||||
return self._app
|
||||
|
||||
|
||||
class RSTParser(docutils.parsers.rst.Parser, Parser):
|
||||
"""A reST parser for Sphinx."""
|
||||
|
Loading…
Reference in New Issue
Block a user