Deprecate sphinx.writers.latex.LaTeXWriter.docclasses

This commit is contained in:
Takeshi KOMIYA
2021-12-16 02:01:15 +09:00
parent eb1a8a3341
commit 26cd8f100c
4 changed files with 20 additions and 3 deletions

View File

@@ -4,6 +4,8 @@ Release 5.0.0 (in development)
Dependencies
------------
* ``sphinx.writers.latex.LaTeXWriter.docclasses``
Incompatible changes
--------------------

View File

@@ -22,6 +22,11 @@ The following is a list of deprecated interfaces.
- (will be) Removed
- Alternatives
* - ``sphinx.writers.latex.LaTeXWriter.docclasses``
- 5.0
- 7.0
- N/A
* - ``sphinx.ext.autodoc.AttributeDocumenter._datadescriptor``
- 4.3
- 6.0

View File

@@ -22,6 +22,10 @@ class RemovedInSphinx60Warning(PendingDeprecationWarning):
pass
class RemovedInSphinx70Warning(PendingDeprecationWarning):
pass
RemovedInNextVersionWarning = RemovedInSphinx50Warning

View File

@@ -12,6 +12,7 @@
"""
import re
import warnings
from collections import defaultdict
from os import path
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Set, Tuple, cast
@@ -20,6 +21,7 @@ from docutils import nodes, writers
from docutils.nodes import Element, Node, Text
from sphinx import addnodes, highlighting
from sphinx.deprecation import RemovedInSphinx70Warning
from sphinx.domains import IndexEntry
from sphinx.domains.std import StandardDomain
from sphinx.errors import SphinxError
@@ -268,9 +270,6 @@ class LaTeXTranslator(SphinxTranslator):
# default is originally 3. For book/report, 2 is already LaTeX default.
ignore_missing_images = False
# sphinx specific document classes
docclasses = ('howto', 'manual')
def __init__(self, document: nodes.document, builder: "LaTeXBuilder",
theme: "Theme") -> None:
super().__init__(document, builder)
@@ -2038,6 +2037,13 @@ class LaTeXTranslator(SphinxTranslator):
def unknown_visit(self, node: Node) -> None:
raise NotImplementedError('Unknown node: ' + node.__class__.__name__)
@property
def docclasses(self) -> Tuple[str, str]:
"""Prepends prefix to sphinx document classes"""
warnings.warn('LaTeXWriter.docclasses() is deprecated.',
RemovedInSphinx70Warning, stacklevel=2)
return ('howto', 'manual')
# FIXME: Workaround to avoid circular import
# refs: https://github.com/sphinx-doc/sphinx/issues/5433