Deprecate footnotes helpers

This commit is contained in:
Takeshi KOMIYA 2018-04-20 22:14:49 +09:00
parent 6977270b66
commit abf8999ce7
3 changed files with 59 additions and 3 deletions

View File

@ -36,6 +36,11 @@ Deprecated
* ``env._nitpick_ignore`` is deprecated
* ``app.override_domain()`` is deprecated
* ``app.add_stylesheet()`` is deprecated
* ``sphinx.writers.latex.Table.caption_footnotetexts`` is deprecated
* ``sphinx.writers.latex.Table.header_footnotetexts`` is deprecated
* ``sphinx.writers.latex.LaTeXWriter.footnotestack`` is deprecated
* ``sphinx.writers.latex.LaTeXWriter.restrict_footnote()`` is deprecated
* ``sphinx.writers.latex.LaTeXWriter.unrestrict_footnote()`` is deprecated
For more details, see `deprecation APIs list
<http://www.sphinx-doc.org/en/master/extdev/index.html#deprecated-apis>`_

View File

@ -119,6 +119,31 @@ The following is a list of deprecated interface.
- 4.0
- :meth:`~sphinx.application.Sphinx.add_css_file()`
* - ``sphinx.writers.latex.Table.caption_footnotetexts``
- 1.8
- 3.0
- -
* - ``sphinx.writers.latex.Table.header_footnotetexts``
- 1.8
- 3.0
- -
* - ``sphinx.writers.latex.LaTeXWriter.footnotestack``
- 1.8
- 3.0
- -
* - ``sphinx.writers.latex.LaTeXWriter.restrict_footnote()``
- 1.8
- 3.0
- -
* - ``sphinx.writers.latex.LaTeXWriter.unrestrict_footnote()``
- 1.8
- 3.0
- -
* - ``sphinx.application.Sphinx.override_domain()``
- 1.8
- 3.0

View File

@ -14,6 +14,7 @@
import re
import sys
import warnings
from collections import defaultdict
from os import path
@ -25,6 +26,7 @@ from sphinx import addnodes
from sphinx import highlighting
from sphinx.builders.latex.nodes import footnotetext
from sphinx.builders.latex.transforms import URI_SCHEMES, ShowUrlsTransform # NOQA # for compatibility
from sphinx.deprecation import RemovedInSphinx30Warning
from sphinx.errors import SphinxError
from sphinx.locale import admonitionlabels, _, __
from sphinx.util import split_into, logging
@ -240,8 +242,6 @@ class Table(object):
self.has_oldproblematic = False
self.has_verbatim = False
self.caption = None # type: List[unicode]
self.caption_footnotetexts = [] # type: List[unicode]
self.header_footnotetexts = [] # type: List[unicode]
self.stubs = [] # type: List[int]
# current position
@ -255,6 +255,20 @@ class Table(object):
# (cell = rectangular area)
self.cell_id = 0 # last assigned cell_id
@property
def caption_footnotetexts(self):
# type: () -> List[unicode]
warnings.warn('table.caption_footnotetexts is deprecated.',
RemovedInSphinx30Warning)
return []
@property
def header_footnotetexts(self):
# type: () -> List[unicode]
warnings.warn('table.header_footnotetexts is deprecated.',
RemovedInSphinx30Warning)
return []
def is_longtable(self):
# type: () -> bool
"""True if and only if table uses longtable environment."""
@ -631,7 +645,6 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.hlsettingstack = 2 * [[builder.config.highlight_language,
sys.maxsize]]
self.bodystack = [] # type: List[List[unicode]]
self.footnotestack = [] # type: List[Dict[unicode, List[Union[collected_footnote, bool]]]] # NOQA
self.footnote_restricted = False
self.pending_footnotes = [] # type: List[nodes.footnote_reference]
self.curfilestack = [] # type: List[unicode]
@ -668,12 +681,18 @@ class LaTeXTranslator(nodes.NodeVisitor):
def restrict_footnote(self, node):
# type: (nodes.Node) -> None
warnings.warn('LaTeXWriter.restrict_footnote() is deprecated.',
RemovedInSphinx30Warning)
if self.footnote_restricted is False:
self.footnote_restricted = node
self.pending_footnotes = []
def unrestrict_footnote(self, node):
# type: (nodes.Node) -> None
warnings.warn('LaTeXWriter.unrestrict_footnote() is deprecated.',
RemovedInSphinx30Warning)
if self.footnote_restricted == node:
self.footnote_restricted = False
for footnode in self.pending_footnotes:
@ -681,6 +700,13 @@ class LaTeXTranslator(nodes.NodeVisitor):
footnode.walkabout(self)
self.pending_footnotes = []
@property
def footnotestack(self):
# type: () -> List[Dict[unicode, List[Union[collected_footnote, bool]]]]
warnings.warn('LaTeXWriter.footnotestack is deprecated.',
RemovedInSphinx30Warning)
return []
def format_docclass(self, docclass):
# type: (unicode) -> unicode
""" prepends prefix to sphinx document classes