summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-12-16 00:21:43 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2018-12-16 21:52:30 +0900
commit1bf9a7eac5996058d9294aabaeec48aa5444ed1f (patch)
tree467d1034da840b90093fc4af9b7b0cb71c0bb2a1
parentcdb36fbbf63cc5cc63813c24c3e4bc9a46abe824 (diff)
downloadsphinx-git-1bf9a7eac5996058d9294aabaeec48aa5444ed1f.tar.gz
Deprecate LaTeXTranslator.collect_footnotes()
-rw-r--r--CHANGES1
-rw-r--r--doc/extdev/index.rst5
-rw-r--r--sphinx/writers/latex.py45
3 files changed, 30 insertions, 21 deletions
diff --git a/CHANGES b/CHANGES
index b5ddb047c..608b57d40 100644
--- a/CHANGES
+++ b/CHANGES
@@ -73,6 +73,7 @@ Deprecated
* ``sphinx.util.pycompat.u``
* ``sphinx.writers.latex.LaTeXTranslator._make_visit_admonition()``
* ``sphinx.writers.latex.LaTeXTranslator.babel_defmacro()``
+* ``sphinx.writers.latex.LaTeXTranslator.collect_footnotes()``
* ``sphinx.writers.texinfo.TexinfoTranslator._make_visit_admonition()``
* ``sphinx.writers.text.TextTranslator._make_depart_admonition()``
* template variables for LaTeX template
diff --git a/doc/extdev/index.rst b/doc/extdev/index.rst
index 5a0b7be46..946b96479 100644
--- a/doc/extdev/index.rst
+++ b/doc/extdev/index.rst
@@ -262,6 +262,11 @@ The following is a list of deprecated interfaces.
- 3.0
- N/A
+ * - ``sphinx.writers.latex.LaTeXTranslator.collect_footnotes()``
+ - 2.0
+ - 4.0
+ - N/A
+
* - ``sphinx.writers.texinfo.TexinfoTranslator._make_visit_admonition()``
- 2.0
- 3.0
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index 4dd73abac..318639ac8 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -915,27 +915,6 @@ class LaTeXTranslator(SphinxTranslator):
# type: (nodes.Element) -> None
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):
# type: (nodes.Element) -> None
self.curfilestack.pop()
@@ -2585,6 +2564,30 @@ class LaTeXTranslator(SphinxTranslator):
# --------- 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
def footnotestack(self):
# type: () -> List[Dict[str, List[Union[collected_footnote, bool]]]]