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

Skip to content

Commit ff883a6

Browse files
committed
Merge pull request #1024 from mdboom/fix-gallery
broken links in the gallery
2 parents 8089e04 + 64e64f6 commit ff883a6

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

doc/sphinxext/gen_gallery.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import os, glob, re, sys, warnings
1717
import matplotlib.image as image
1818

19-
multiimage = re.compile('(.*)_\d\d')
19+
multiimage = re.compile('(.*?)(_\d\d){1,2}')
2020

2121
def make_thumbnail(args):
2222
image.thumbnail(args[0], args[1], 0.3)
@@ -68,11 +68,8 @@ def gen_gallery(app, doctree):
6868
thumbnails[orig_path] = thumb_path
6969

7070
m = multiimage.match(basename)
71-
if m is None:
72-
pyfile = '%s.py'%basename
73-
else:
71+
if m is not None:
7472
basename = m.group(1)
75-
pyfile = '%s.py'%basename
7673

7774
data.append((subdir, basename,
7875
os.path.join(rootdir, subdir, 'thumbnails', filename)))

0 commit comments

Comments
 (0)