mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix the handling of images in different directories.
This commit is contained in:
@@ -18,3 +18,6 @@ Sphinx image handling
|
||||
|
||||
.. a non-local image URI
|
||||
.. image:: http://www.python.org/logo.png
|
||||
|
||||
.. an image with subdir and unspecified extension
|
||||
.. image:: subdir/simg.*
|
||||
|
||||
BIN
tests/root/subdir/simg.png
Normal file
BIN
tests/root/subdir/simg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
@@ -27,7 +27,7 @@ latex_warnfile = StringIO()
|
||||
|
||||
ENV_WARNINGS = """\
|
||||
WARNING: %(root)s/images.txt:9: Image file not readable: foo.png
|
||||
WARNING: %(root)s/images.txt:20: Nonlocal image URI found: http://www.python.org/logo.png
|
||||
WARNING: %(root)s/images.txt:21: 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
|
||||
"""
|
||||
@@ -44,6 +44,7 @@ HTML_XPATH = {
|
||||
'images.html': {
|
||||
".//img[@src='_images/img.png']": '',
|
||||
".//img[@src='_images/img1.png']": '',
|
||||
".//img[@src='_images/simg.png']": '',
|
||||
},
|
||||
'includes.html': {
|
||||
".//pre/span[@class='s']": u'üöä',
|
||||
|
||||
@@ -54,16 +54,19 @@ def test_images():
|
||||
htmlbuilder = StandaloneHTMLBuilder(app, env)
|
||||
htmlbuilder.post_process_images(tree)
|
||||
assert "no matching candidate for image URI u'foo.*'" in app._warning.content[-1]
|
||||
assert set(htmlbuilder.images.keys()) == set(['subdir/img.png', 'img.png'])
|
||||
assert set(htmlbuilder.images.values()) == set(['img.png', 'img1.png'])
|
||||
assert set(htmlbuilder.images.keys()) == set(['subdir/img.png', 'img.png',
|
||||
'subdir/simg.png'])
|
||||
assert set(htmlbuilder.images.values()) == set(['img.png', 'img1.png',
|
||||
'simg.png'])
|
||||
|
||||
app._warning.reset()
|
||||
latexbuilder = LaTeXBuilder(app, env)
|
||||
latexbuilder.post_process_images(tree)
|
||||
assert "no matching candidate for image URI u'foo.*'" in app._warning.content[-1]
|
||||
assert set(latexbuilder.images.keys()) == set(['subdir/img.png',
|
||||
assert set(latexbuilder.images.keys()) == set(['subdir/img.png', 'subdir/simg.png',
|
||||
'img.png', 'img.pdf'])
|
||||
assert set(latexbuilder.images.values()) == set(['img.pdf', 'img.png', 'img1.png'])
|
||||
assert set(latexbuilder.images.values()) == set(['img.pdf', 'img.png',
|
||||
'img1.png', 'simg.pdf'])
|
||||
|
||||
def test_second_update():
|
||||
# delete, add and "edit" (change saved mtime) some files and update again
|
||||
|
||||
Reference in New Issue
Block a user