From 64e64f68caf56d04d99180024fce201d374ce429 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Fri, 3 Aug 2012 15:09:18 -0400 Subject: [PATCH] Fix gallery links (#1024) --- doc/sphinxext/gen_gallery.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/doc/sphinxext/gen_gallery.py b/doc/sphinxext/gen_gallery.py index aadc2c0e9b8c..45e2d47370d7 100644 --- a/doc/sphinxext/gen_gallery.py +++ b/doc/sphinxext/gen_gallery.py @@ -16,7 +16,7 @@ import os, glob, re, sys, warnings import matplotlib.image as image -multiimage = re.compile('(.*)_\d\d') +multiimage = re.compile('(.*?)(_\d\d){1,2}') def make_thumbnail(args): image.thumbnail(args[0], args[1], 0.3) @@ -68,11 +68,8 @@ def gen_gallery(app, doctree): thumbnails[orig_path] = thumb_path m = multiimage.match(basename) - if m is None: - pyfile = '%s.py'%basename - else: + if m is not None: basename = m.group(1) - pyfile = '%s.py'%basename data.append((subdir, basename, os.path.join(rootdir, subdir, 'thumbnails', filename)))