Fix #2206: Sphinx latex doc build failed if footnotes in caption of figure

At same time, refactored around pending footnotes (tables, terms and
figures). They are all controled as ``pending_footnotes``.
This commit is contained in:
Takeshi KOMIYA
2016-01-01 17:28:22 +09:00
parent 07cc02a512
commit 584f05154b
4 changed files with 39 additions and 26 deletions

View File

@@ -46,3 +46,9 @@ Footnote in term [#]_
Description2
.. [#] Footnote in term
.. figure:: rimg.png
This is the figure caption with a footnote to [#]_.
.. [#] Footnote in caption

View File

@@ -332,6 +332,9 @@ def test_reference_in_caption(app, status, warning):
assert '\\caption{The table title with a reference to {[}AuthorYear{]}}' in result
assert '\\paragraph{The rubric title with a reference to {[}AuthorYear{]}}' in result
assert '\\chapter{The section with a reference to \\protect\\footnotemark[1]}' in result
assert ('\\caption{This is the figure caption with a footnote to '
'\\protect\\footnotemark[5].}\end{figure}\n'
'\\footnotetext[5]{\nFootnote in caption\n}')in result
@with_app(buildername='latex', testroot='footnotes',
@@ -350,7 +353,7 @@ def test_latex_show_urls_is_inline(app, status, warning):
'(http://sphinx-doc.org/\\textasciitilde{}test/)' in result)
assert ('\\item[{\\href{http://sphinx-doc.org/}{URL in term} (http://sphinx-doc.org/)}] '
'\\leavevmode\nDescription' in result)
assert ('\\item[{Footnote in term \\footnotemark[4]}] '
assert ('\\item[{Footnote in term \\protect\\footnotemark[4]}] '
'\\leavevmode\\footnotetext[4]{\nFootnote in term\n}\nDescription' in result)
assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist} '
'(http://sphinx-doc.org/)}] \\leavevmode\nDescription' in result)
@@ -375,11 +378,11 @@ def test_latex_show_urls_is_footnote(app, status, warning):
assert 'Third footnote: \\footnote[5]{\nThird\n}' in result
assert ('\\href{http://sphinx-doc.org/~test/}{URL including tilde}'
'\\footnote[4]{\nhttp://sphinx-doc.org/\\textasciitilde{}test/\n}' in result)
assert ('\\item[{\\href{http://sphinx-doc.org/}{URL in term}\\footnotemark[6]}] '
assert ('\\item[{\\href{http://sphinx-doc.org/}{URL in term}\\protect\\footnotemark[6]}] '
'\\leavevmode\\footnotetext[6]{\nhttp://sphinx-doc.org/\n}\nDescription' in result)
assert ('\\item[{Footnote in term \\footnotemark[8]}] '
assert ('\\item[{Footnote in term \\protect\\footnotemark[8]}] '
'\\leavevmode\\footnotetext[8]{\nFootnote in term\n}\nDescription' in result)
assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist}\\footnotemark[7]}] '
assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist}\\protect\\footnotemark[7]}] '
'\\leavevmode\\footnotetext[7]{\nhttp://sphinx-doc.org/\n}\nDescription' in result)
assert ('\\href{https://github.com/sphinx-doc/sphinx}'
'{https://github.com/sphinx-doc/sphinx}\n' in result)
@@ -402,7 +405,7 @@ def test_latex_show_urls_is_no(app, status, warning):
assert '\\href{http://sphinx-doc.org/~test/}{URL including tilde}' in result
assert ('\\item[{\\href{http://sphinx-doc.org/}{URL in term}}] '
'\\leavevmode\nDescription' in result)
assert ('\\item[{Footnote in term \\footnotemark[4]}] '
assert ('\\item[{Footnote in term \\protect\\footnotemark[4]}] '
'\\leavevmode\\footnotetext[4]{\nFootnote in term\n}\nDescription' in result)
assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist}}] '
'\\leavevmode\nDescription' in result)