Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 03427e5

Browse files
committed
Revert changes to plot_directive that resulted in links to images in different formats being missing.
1 parent c05537d commit 03427e5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/matplotlib/sphinxext/plot_directive.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -568,10 +568,14 @@ def render_figures(code, code_path, output_dir, output_base, context,
568568
# Look for single-figure output files first
569569
all_exists = True
570570
img = ImageFile(output_base, output_dir)
571-
if not any(out_of_date(code_path, img.filename(fmt))
572-
for fmt, dpi in formats):
571+
for format, dpi in formats:
572+
if out_of_date(code_path, img.filename(format)):
573+
all_exists = False
574+
break
575+
img.formats.append(format)
576+
577+
if all_exists:
573578
return [(code, [img])]
574-
img.formats.extend(fmt for fmt, dpi in formats)
575579

576580
# Then look for multi-figure output files
577581
results = []

0 commit comments

Comments
 (0)