forked from github/pelican
parent
b2231c40f7
commit
6cadbdf354
2 changed files with 8 additions and 3 deletions
|
|
@ -100,8 +100,8 @@ class Generator(object):
|
|||
"""Inclusion logic for .get_files(), returns True/False
|
||||
|
||||
:param path: the path which might be including
|
||||
:param extensions: the list of allowed extensions (if False, all
|
||||
extensions are allowed)
|
||||
:param extensions: the list of allowed extensions, or False if all
|
||||
extensions are allowed
|
||||
"""
|
||||
if extensions is None:
|
||||
extensions = tuple(self.readers.extensions)
|
||||
|
|
@ -112,8 +112,10 @@ class Generator(object):
|
|||
if any(fnmatch.fnmatch(basename, ignore) for ignore in ignores):
|
||||
return False
|
||||
|
||||
if extensions is False or basename.endswith(extensions):
|
||||
ext = os.path.splitext(basename)[1][1:]
|
||||
if extensions is False or ext in extensions:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def get_files(self, paths, exclude=[], extensions=None):
|
||||
|
|
|
|||
3
pelican/tests/content/bad_extension.mmd
Normal file
3
pelican/tests/content/bad_extension.mmd
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Title: Bad Extension
|
||||
|
||||
This file shouldn't be included because its file extension is `.mmd`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue