Merge branch 'stable'

This commit is contained in:
Takeshi KOMIYA 2017-10-02 00:41:21 +09:00
commit 1892fc18b9
7 changed files with 39 additions and 4 deletions

View File

@ -95,6 +95,10 @@ Features added
Bugs fixed Bugs fixed
---------- ----------
* #4085: Failed PDF build from image in parsed-literal using ``:align:`` option
* #4100: Remove debug print from autodoc extension
* #3987: Changing theme from alabaster causes HTML build to fail
Testing Testing
-------- --------

View File

@ -716,7 +716,6 @@ class Documenter(object):
# keep documented attributes # keep documented attributes
keep = True keep = True
isattr = True isattr = True
print(membername, keep)
elif want_all and membername.startswith('_'): elif want_all and membername.startswith('_'):
# ignore members whose name starts with _ by default # ignore members whose name starts with _ by default
keep = self.options.private_members and \ keep = self.options.private_members and \

View File

@ -1700,9 +1700,6 @@ class LaTeXTranslator(nodes.NodeVisitor):
pre = [] # type: List[unicode] pre = [] # type: List[unicode]
# in reverse order # in reverse order
post = [] # type: List[unicode] post = [] # type: List[unicode]
if self.in_parsed_literal:
pre = ['\\begingroup\\sphinxunactivateextrasandspace\\relax ']
post = ['\\endgroup ']
include_graphics_options = [] include_graphics_options = []
is_inline = self.is_inline(node) is_inline = self.is_inline(node)
if 'width' in attrs: if 'width' in attrs:
@ -1742,6 +1739,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
post.append(align_prepost[is_inline, attrs['align']][1]) post.append(align_prepost[is_inline, attrs['align']][1])
except KeyError: except KeyError:
pass pass
if self.in_parsed_literal:
pre.append('{\\sphinxunactivateextrasandspace ')
post.append('}')
if not is_inline: if not is_inline:
pre.append('\n\\noindent') pre.append('\n\\noindent')
post.append('\n') post.append('\n')

View File

@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
exclude_patterns = ['_build']
rst_epilog = '''
.. |picture| image:: pic.png
:height: 1cm
:scale: 200%
:align: middle
:alt: alternative_text
'''

View File

@ -0,0 +1,9 @@
test-image-in-parsed-literal
============================
Dummy text
.. parsed-literal::
|picture|\ AFTER

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

View File

@ -1028,3 +1028,13 @@ def test_latex_index(app, status, warning):
result = (app.outdir / 'Python.tex').text(encoding='utf8') result = (app.outdir / 'Python.tex').text(encoding='utf8')
assert 'A \\index{famous}famous \\index{equation}equation:\n' in result assert 'A \\index{famous}famous \\index{equation}equation:\n' in result
assert '\n\\index{Einstein}\\index{relativity}\\ignorespaces \nand' in result assert '\n\\index{Einstein}\\index{relativity}\\ignorespaces \nand' in result
@pytest.mark.sphinx('latex', testroot='image-in-parsed-literal')
def test_latex_image_in_parsed_literal(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'Python.tex').text(encoding='utf8')
assert ('{\\sphinxunactivateextrasandspace \\raisebox{-0.5\height}'
'{\\scalebox{2.000000}{\\sphinxincludegraphics[height=1cm]{{pic}.png}}}'
'}AFTER') in result