diff options
author | Stefan Wiehler <stefan.wiehler@missinglinkelectronics.com> | 2021-01-04 12:16:46 +0300 |
---|---|---|
committer | Stefan Wiehler <stefan.wiehler@missinglinkelectronics.com> | 2021-01-04 12:32:46 +0300 |
commit | ef236696535877048fdea61df54addb6fb3728f0 (patch) | |
tree | a1a0cd0d3d60f4faf9e9c0f4f89a34ba29d920b6 /sphinx/transforms | |
parent | 1b7d16505ea6e77586c6c4f4afc15a3e73116d80 (diff) |
Skip imgconverter availability check if builder supports the image type
Close #7973: ImgConverter runs is_available in HTML builder
Close missinglinkelectronics/sphinxcontrib-svg2pdfconverter#8: Extension should only run on LaTeX builder
Diffstat (limited to 'sphinx/transforms')
-rw-r--r-- | sphinx/transforms/post_transforms/images.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sphinx/transforms/post_transforms/images.py b/sphinx/transforms/post_transforms/images.py index fb4c3ca20..2603e0458 100644 --- a/sphinx/transforms/post_transforms/images.py +++ b/sphinx/transforms/post_transforms/images.py @@ -197,15 +197,15 @@ 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): + # builder supports the image; no need to convert + return False elif self.available is None: # store the value to the class variable to share it during the build self.__class__.available = self.is_available() if not self.available: return False - elif set(node['candidates']) & set(self.app.builder.supported_image_types): - # builder supports the image; no need to convert - return False else: rule = self.get_conversion_rule(node) if rule: |