mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Deprecate LaTeXTranslator.collect_footnotes()
This commit is contained in:
parent
cdb36fbbf6
commit
1bf9a7eac5
1
CHANGES
1
CHANGES
@ -73,6 +73,7 @@ Deprecated
|
|||||||
* ``sphinx.util.pycompat.u``
|
* ``sphinx.util.pycompat.u``
|
||||||
* ``sphinx.writers.latex.LaTeXTranslator._make_visit_admonition()``
|
* ``sphinx.writers.latex.LaTeXTranslator._make_visit_admonition()``
|
||||||
* ``sphinx.writers.latex.LaTeXTranslator.babel_defmacro()``
|
* ``sphinx.writers.latex.LaTeXTranslator.babel_defmacro()``
|
||||||
|
* ``sphinx.writers.latex.LaTeXTranslator.collect_footnotes()``
|
||||||
* ``sphinx.writers.texinfo.TexinfoTranslator._make_visit_admonition()``
|
* ``sphinx.writers.texinfo.TexinfoTranslator._make_visit_admonition()``
|
||||||
* ``sphinx.writers.text.TextTranslator._make_depart_admonition()``
|
* ``sphinx.writers.text.TextTranslator._make_depart_admonition()``
|
||||||
* template variables for LaTeX template
|
* template variables for LaTeX template
|
||||||
|
@ -262,6 +262,11 @@ The following is a list of deprecated interfaces.
|
|||||||
- 3.0
|
- 3.0
|
||||||
- N/A
|
- N/A
|
||||||
|
|
||||||
|
* - ``sphinx.writers.latex.LaTeXTranslator.collect_footnotes()``
|
||||||
|
- 2.0
|
||||||
|
- 4.0
|
||||||
|
- N/A
|
||||||
|
|
||||||
* - ``sphinx.writers.texinfo.TexinfoTranslator._make_visit_admonition()``
|
* - ``sphinx.writers.texinfo.TexinfoTranslator._make_visit_admonition()``
|
||||||
- 2.0
|
- 2.0
|
||||||
- 3.0
|
- 3.0
|
||||||
|
@ -915,27 +915,6 @@ class LaTeXTranslator(SphinxTranslator):
|
|||||||
# type: (nodes.Element) -> None
|
# type: (nodes.Element) -> None
|
||||||
self.curfilestack.append(node['docname'])
|
self.curfilestack.append(node['docname'])
|
||||||
|
|
||||||
def collect_footnotes(self, node):
|
|
||||||
# type: (nodes.Element) -> Dict[str, List[Union[collected_footnote, bool]]]
|
|
||||||
def footnotes_under(n):
|
|
||||||
# type: (nodes.Element) -> Iterator[nodes.footnote]
|
|
||||||
if isinstance(n, nodes.footnote):
|
|
||||||
yield n
|
|
||||||
else:
|
|
||||||
for c in n.children:
|
|
||||||
if isinstance(c, addnodes.start_of_file):
|
|
||||||
continue
|
|
||||||
elif isinstance(c, nodes.Element):
|
|
||||||
yield from footnotes_under(c)
|
|
||||||
|
|
||||||
fnotes = {} # type: Dict[str, List[Union[collected_footnote, bool]]]
|
|
||||||
for fn in footnotes_under(node):
|
|
||||||
label = cast(nodes.label, fn[0])
|
|
||||||
num = label.astext().strip()
|
|
||||||
newnode = collected_footnote('', *fn.children, number=num)
|
|
||||||
fnotes[num] = [newnode, False]
|
|
||||||
return fnotes
|
|
||||||
|
|
||||||
def depart_start_of_file(self, node):
|
def depart_start_of_file(self, node):
|
||||||
# type: (nodes.Element) -> None
|
# type: (nodes.Element) -> None
|
||||||
self.curfilestack.pop()
|
self.curfilestack.pop()
|
||||||
@ -2585,6 +2564,30 @@ class LaTeXTranslator(SphinxTranslator):
|
|||||||
|
|
||||||
# --------- METHODS FOR COMPATIBILITY --------------------------------------
|
# --------- METHODS FOR COMPATIBILITY --------------------------------------
|
||||||
|
|
||||||
|
def collect_footnotes(self, node):
|
||||||
|
# type: (nodes.Element) -> Dict[str, List[Union[collected_footnote, bool]]]
|
||||||
|
def footnotes_under(n):
|
||||||
|
# type: (nodes.Element) -> Iterator[nodes.footnote]
|
||||||
|
if isinstance(n, nodes.footnote):
|
||||||
|
yield n
|
||||||
|
else:
|
||||||
|
for c in n.children:
|
||||||
|
if isinstance(c, addnodes.start_of_file):
|
||||||
|
continue
|
||||||
|
elif isinstance(c, nodes.Element):
|
||||||
|
yield from footnotes_under(c)
|
||||||
|
|
||||||
|
warnings.warn('LaTeXWriter.collected_footnote() is deprecated.',
|
||||||
|
RemovedInSphinx40Warning, stacklevel=2)
|
||||||
|
|
||||||
|
fnotes = {} # type: Dict[str, List[Union[collected_footnote, bool]]]
|
||||||
|
for fn in footnotes_under(node):
|
||||||
|
label = cast(nodes.label, fn[0])
|
||||||
|
num = label.astext().strip()
|
||||||
|
newnode = collected_footnote('', *fn.children, number=num)
|
||||||
|
fnotes[num] = [newnode, False]
|
||||||
|
return fnotes
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def footnotestack(self):
|
def footnotestack(self):
|
||||||
# type: () -> List[Dict[str, List[Union[collected_footnote, bool]]]]
|
# type: () -> List[Dict[str, List[Union[collected_footnote, bool]]]]
|
||||||
|
Loading…
Reference in New Issue
Block a user