diff --git a/sphinx_gallery/gen_rst.py b/sphinx_gallery/gen_rst.py index 2e1ba3ea5..398948ce1 100644 --- a/sphinx_gallery/gen_rst.py +++ b/sphinx_gallery/gen_rst.py @@ -434,9 +434,11 @@ def generate_dir_rst(src_dir, target_dir, gallery_conf, seen_backrefs): # get filenames listdir = [fname for fname in os.listdir(src_dir) if fname.endswith('.py')] - # limit which to look at based on regex + # limit which to look at based on regex (similar to filename_pattern) listdir = [fname for fname in listdir - if re.match(gallery_conf['ignore_pattern'], fname) is None] + if re.search(gallery_conf['ignore_pattern'], + os.path.normpath(os.path.join(src_dir, fname))) + is None] # sort them sorted_listdir = sorted( listdir, key=gallery_conf['within_subsection_order'](src_dir)) diff --git a/sphinx_gallery/tests/tinybuild/examples/__init__.py b/sphinx_gallery/tests/tinybuild/examples/__init__.py index 52606c912..f634a1b51 100644 --- a/sphinx_gallery/tests/tinybuild/examples/__init__.py +++ b/sphinx_gallery/tests/tinybuild/examples/__init__.py @@ -1 +1,2 @@ -from numpy import pad +# This file is ignored through ignore_pattern so it does not need to have a +# docstring following the sphinx-gallery convention (i.e. title + description)