mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #2182 from xuhdev/latex-dots-images
Fix #981: LaTeX: support image file names with more than 1 dots
This commit is contained in:
@@ -1182,7 +1182,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
options = ''
|
||||
if include_graphics_options:
|
||||
options = '[%s]' % ','.join(include_graphics_options)
|
||||
self.body.append('\\includegraphics%s{%s}' % (options, uri))
|
||||
base, ext = path.splitext(uri)
|
||||
self.body.append('\\includegraphics%s{{%s}%s}' % (options, base, ext))
|
||||
self.body.extend(post)
|
||||
|
||||
def depart_image(self, node):
|
||||
|
||||
@@ -26,3 +26,6 @@ Sphinx image handling
|
||||
|
||||
.. an SVG image (for HTML at least)
|
||||
.. image:: svgimg.*
|
||||
|
||||
.. an image with more than 1 dot in its file name
|
||||
.. image:: img.foo.png
|
||||
|
||||
BIN
tests/root/img.foo.png
Normal file
BIN
tests/root/img.foo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
@@ -63,9 +63,10 @@ def test_images():
|
||||
image_uri_message = remove_unicode_literals(image_uri_message)
|
||||
assert image_uri_message in app._warning.content[-1]
|
||||
assert set(htmlbuilder.images.keys()) == \
|
||||
set(['subdir/img.png', 'img.png', 'subdir/simg.png', 'svgimg.svg'])
|
||||
set(['subdir/img.png', 'img.png', 'subdir/simg.png', 'svgimg.svg',
|
||||
'img.foo.png'])
|
||||
assert set(htmlbuilder.images.values()) == \
|
||||
set(['img.png', 'img1.png', 'simg.png', 'svgimg.svg'])
|
||||
set(['img.png', 'img1.png', 'simg.png', 'svgimg.svg', 'img.foo.png'])
|
||||
|
||||
app._warning.reset()
|
||||
latexbuilder = LaTeXBuilder(app)
|
||||
@@ -73,9 +74,10 @@ def test_images():
|
||||
assert image_uri_message in app._warning.content[-1]
|
||||
assert set(latexbuilder.images.keys()) == \
|
||||
set(['subdir/img.png', 'subdir/simg.png', 'img.png', 'img.pdf',
|
||||
'svgimg.pdf'])
|
||||
'svgimg.pdf', 'img.foo.png'])
|
||||
assert set(latexbuilder.images.values()) == \
|
||||
set(['img.pdf', 'img.png', 'img1.png', 'simg.png', 'svgimg.pdf'])
|
||||
set(['img.pdf', 'img.png', 'img1.png', 'simg.png',
|
||||
'svgimg.pdf', 'img.foo.png'])
|
||||
|
||||
|
||||
def test_second_update():
|
||||
|
||||
Reference in New Issue
Block a user