mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix combination of figure directive options; width, figwidth and align (ref: #2595)
This commit is contained in:
@@ -1431,7 +1431,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
node.children[0]['ids']):
|
node.children[0]['ids']):
|
||||||
ids += self.hypertarget(node.children[0]['ids'][0], anchor=False)
|
ids += self.hypertarget(node.children[0]['ids'][0], anchor=False)
|
||||||
if node.get('align', '') in ('left', 'right'):
|
if node.get('align', '') in ('left', 'right'):
|
||||||
if 'width' in node[0]:
|
if 'width' in node:
|
||||||
|
length = width_to_latex_length(node['width'])
|
||||||
|
elif 'width' in node[0]:
|
||||||
length = width_to_latex_length(node[0]['width'])
|
length = width_to_latex_length(node[0]['width'])
|
||||||
else:
|
else:
|
||||||
length = '0pt'
|
length = '0pt'
|
||||||
|
|||||||
@@ -246,6 +246,12 @@ Figures
|
|||||||
|
|
||||||
figure with align & figwidth option
|
figure with align & figwidth option
|
||||||
|
|
||||||
|
.. figure:: rimg.png
|
||||||
|
:align: right
|
||||||
|
:width: 3cm
|
||||||
|
|
||||||
|
figure with align & width option
|
||||||
|
|
||||||
Version markup
|
Version markup
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
|||||||
@@ -31,14 +31,14 @@ http://www.python.org/logo.png
|
|||||||
reading included file u'.*?wrongenc.inc' seems to be wrong, try giving an \
|
reading included file u'.*?wrongenc.inc' seems to be wrong, try giving an \
|
||||||
:encoding: option\\n?
|
:encoding: option\\n?
|
||||||
%(root)s/includes.txt:4: WARNING: download file not readable: .*?nonexisting.png
|
%(root)s/includes.txt:4: WARNING: download file not readable: .*?nonexisting.png
|
||||||
(%(root)s/markup.txt:373: WARNING: invalid single index entry u'')?
|
(%(root)s/markup.txt:379: WARNING: invalid single index entry u'')?
|
||||||
(%(root)s/undecodable.txt:3: WARNING: undecodable source characters, replacing \
|
(%(root)s/undecodable.txt:3: WARNING: undecodable source characters, replacing \
|
||||||
with "\\?": b?'here: >>>(\\\\|/)xbb<<<'
|
with "\\?": b?'here: >>>(\\\\|/)xbb<<<'
|
||||||
)?"""
|
)?"""
|
||||||
|
|
||||||
HTML_WARNINGS = ENV_WARNINGS + """\
|
HTML_WARNINGS = ENV_WARNINGS + """\
|
||||||
%(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*'
|
%(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*'
|
||||||
%(root)s/markup.txt:285: WARNING: Could not lex literal_block as "c". Highlighting skipped.
|
%(root)s/markup.txt:291: WARNING: Could not lex literal_block as "c". Highlighting skipped.
|
||||||
%(root)s/footnote.txt:60: WARNING: citation not found: missing
|
%(root)s/footnote.txt:60: WARNING: citation not found: missing
|
||||||
%(root)s/markup.txt:164: WARNING: unknown option: &option
|
%(root)s/markup.txt:164: WARNING: unknown option: &option
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ LATEX_WARNINGS = ENV_WARNINGS + """\
|
|||||||
%(root)s/markup.txt:164: WARNING: unknown option: &option
|
%(root)s/markup.txt:164: WARNING: unknown option: &option
|
||||||
%(root)s/footnote.txt:60: WARNING: citation not found: missing
|
%(root)s/footnote.txt:60: WARNING: citation not found: missing
|
||||||
%(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*'
|
%(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*'
|
||||||
%(root)s/markup.txt:285: WARNING: Could not lex literal_block as "c". Highlighting skipped.
|
%(root)s/markup.txt:291: WARNING: Could not lex literal_block as "c". Highlighting skipped.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if PY3:
|
if PY3:
|
||||||
@@ -119,6 +119,11 @@ def test_writer(app, status, warning):
|
|||||||
'\\includegraphics{{rimg}.png}\n\\caption{figure with align \\& figwidth option}'
|
'\\includegraphics{{rimg}.png}\n\\caption{figure with align \\& figwidth option}'
|
||||||
'\\label{markup:id8}\\end{wrapfigure}' in result)
|
'\\label{markup:id8}\\end{wrapfigure}' in result)
|
||||||
|
|
||||||
|
assert ('\\begin{wrapfigure}{r}{3cm}\n\\centering\n'
|
||||||
|
'\\includegraphics[width=3cm]{{rimg}.png}\n'
|
||||||
|
'\\caption{figure with align \\& width option}'
|
||||||
|
'\\label{markup:id9}\\end{wrapfigure}' in result)
|
||||||
|
|
||||||
|
|
||||||
@with_app(buildername='latex', freshenv=True, # use freshenv to check warnings
|
@with_app(buildername='latex', freshenv=True, # use freshenv to check warnings
|
||||||
confoverrides={'latex_documents': [
|
confoverrides={'latex_documents': [
|
||||||
|
|||||||
Reference in New Issue
Block a user