Merge pull request #2160 from misery/toc

Fix broken TOC of PDFs if section includes an image
This commit is contained in:
Takeshi KOMIYA
2016-01-08 21:41:11 +09:00
5 changed files with 49 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
rst_epilog = '''
.. |picture| image:: pic.png
:width: 15pt
:height: 15pt
:alt: alternative_text
'''

View File

@@ -0,0 +1,18 @@
test-image-in-section
=====================
this is dummy content
|picture| Test section
----------------------
blah blah blah
Another section
---------------
another blah
Other [blah] |picture| section
------------------------------
other blah

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

View File

@@ -423,6 +423,19 @@ def test_latex_show_urls_is_no(app, status, warning):
'{sphinx-dev@googlegroups.com}\n' in result)
@with_app(buildername='latex', testroot='image-in-section')
def test_image_in_section(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'Python.tex').text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
assert ('\chapter[Test section]{\includegraphics[width=15pt,height=15pt]{{pic}.png} Test section}'
in result)
assert ('\chapter[Other {[}blah{]} section]{Other {[}blah{]} \includegraphics[width=15pt,height=15pt]{{pic}.png} section}' in result)
assert ('\chapter{Another section}' in result)
@with_app(buildername='latex', confoverrides={'latex_logo': 'notfound.jpg'})
def test_latex_logo_if_not_found(app, status, warning):
try: