From 058001c83176f72d29477fa7a995ca81ffd60c24 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Mon, 8 Dec 2008 08:52:55 +0100 Subject: [PATCH] Fix #68: invalid latex output for images with height set. --- CHANGES | 9 ++++++--- sphinx/latexwriter.py | 3 ++- tests/root/images.txt | 2 ++ tests/test_build.py | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 593433f92..f7003992e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,12 +1,15 @@ Release 0.5.1 (in development) ============================== -* Fix a bug when including images in sources in subdirectories. +* Fix LaTeX writer output for images with specified height. + +* Fix wrong generated image path when including images in sources + in subdirectories. * Fix the JavaScript search when html_copy_source is off. -* Fix a bug in autodoc when documenting classes with the option. - ``autoclass_content = "both"`` set. +* Fix an indentation problem in autodoc when documenting classes + with the option ``autoclass_content = "both"`` set. * Don't crash on empty index entries, only emit a warning. diff --git a/sphinx/latexwriter.py b/sphinx/latexwriter.py index 514bb7686..3d01f3b75 100644 --- a/sphinx/latexwriter.py +++ b/sphinx/latexwriter.py @@ -750,7 +750,8 @@ class LaTeXTranslator(nodes.NodeVisitor): include_graphics_options.append('width=%s' % w) if attrs.has_key('height'): h = self.latex_image_length(attrs['height']) - include_graphics_options.append('height=%s' % h) + if h: + include_graphics_options.append('height=%s' % h) if attrs.has_key('align'): align_prepost = { # By default latex aligns the top of an image. diff --git a/tests/root/images.txt b/tests/root/images.txt index d73375424..be868dfea 100644 --- a/tests/root/images.txt +++ b/tests/root/images.txt @@ -9,6 +9,8 @@ Sphinx image handling .. an image with path name (relative to this directory!) .. image:: subdir/img.png + :height: 100 + :width: 200 .. an image with unspecified extension .. image:: img.* diff --git a/tests/test_build.py b/tests/test_build.py index bde843b44..b48cccc3f 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -28,7 +28,7 @@ latex_warnfile = StringIO() ENV_WARNINGS = """\ WARNING: %(root)s/images.txt:9: Image file not readable: foo.png -WARNING: %(root)s/images.txt:21: Nonlocal image URI found: http://www.python.org/logo.png +WARNING: %(root)s/images.txt:23: Nonlocal image URI found: http://www.python.org/logo.png WARNING: %(root)s/includes.txt:: (WARNING/2) Encoding 'utf-8' used for reading included \ file u'wrongenc.inc' seems to be wrong, try giving an :encoding: option """