Skip to content

Commit

Permalink
Skip imgconverter availability check if builder supports the image type
Browse files Browse the repository at this point in the history
Close sphinx-doc#7973: ImgConverter runs is_available in HTML builder
Close missinglinkelectronics/sphinxcontrib-svg2pdfconverter#8: Extension should only run on LaTeX builder
  • Loading branch information
Stefan Wiehler committed Jan 4, 2021
1 parent 1b7d165 commit ef23669
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sphinx/transforms/post_transforms/images.py
Expand Up @@ -197,15 +197,15 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
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:
Expand Down

0 comments on commit ef23669

Please sign in to comment.