mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #9103: LaTeX: imgconverter: conversion runs even if not needed
The imgconverter unexpectedly goes to convert even if the given image is supported by the target builder when the image globbing is not used. This enables format guess-ing on not globbed.
This commit is contained in:
parent
8954770f67
commit
5f56d4146e
1
CHANGES
1
CHANGES
@ -16,6 +16,7 @@ Deprecated
|
||||
Features added
|
||||
--------------
|
||||
|
||||
* #9103: LaTeX: imgconverter: conversion runs even if not needed
|
||||
* #9023: More CSS classes on domain descriptions, see :ref:`nodes` for details.
|
||||
|
||||
Bugs fixed
|
||||
|
@ -197,7 +197,7 @@ class ImageConverter(BaseImageConverter):
|
||||
def match(self, node: nodes.image) -> bool:
|
||||
if not self.app.builder.supported_image_types:
|
||||
return False
|
||||
elif set(node['candidates']) & set(self.app.builder.supported_image_types):
|
||||
elif set(self.guess_mimetypes(node)) & set(self.app.builder.supported_image_types):
|
||||
# builder supports the image; no need to convert
|
||||
return False
|
||||
elif self.available is None:
|
||||
|
BIN
tests/roots/test-ext-imgconverter/img.pdf
Normal file
BIN
tests/roots/test-ext-imgconverter/img.pdf
Normal file
Binary file not shown.
@ -2,3 +2,4 @@ test-ext-imgconverter
|
||||
=====================
|
||||
|
||||
.. image:: svgimg.svg
|
||||
.. image:: img.pdf
|
||||
|
@ -19,6 +19,11 @@ def test_ext_imgconverter(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
content = (app.outdir / 'python.tex').read_text()
|
||||
|
||||
# supported image (not converted)
|
||||
assert '\\sphinxincludegraphics{{img}.pdf}' in content
|
||||
|
||||
# non supported image (converted)
|
||||
assert '\\sphinxincludegraphics{{svgimg}.png}' in content
|
||||
assert not (app.outdir / 'svgimg.svg').exists()
|
||||
assert (app.outdir / 'svgimg.png').exists()
|
||||
|
Loading…
Reference in New Issue
Block a user