mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Check full paths when excluding files
The `Generator._include_path` method needs to be updated because it does not filter files with enough specificity. For example, let's say our Pelican project is devoted to hosting article about talks a different conferences. If we wanted to filter a talk at `content/jacksconf-2016/videos/jacks-talk.json`, we could do so (without using this patch) by including `jacks-talk.json` in the list IGNORE_FILES. However, if there are multiple `jacks-talk.json` files (maybe a bunch of different Jacks wanted to talk at a bunch of different conferences), we would exclude all `jacks-talk.json` files by including the single `jacks-talk.json` string in IGNORE_FILES. By checking the full path passed to `_include_path`, we can filter on a more granular level.
This commit is contained in:
parent
d9605d005d
commit
bdd7daf419
1 changed files with 4 additions and 1 deletions
|
|
@ -105,10 +105,13 @@ class Generator(object):
|
|||
"""
|
||||
if extensions is None:
|
||||
extensions = tuple(self.readers.extensions)
|
||||
basename = os.path.basename(path)
|
||||
|
||||
# check IGNORE_FILES
|
||||
ignores = self.settings['IGNORE_FILES']
|
||||
if any(fnmatch.fnmatch(path, ignore) for ignore in ignores):
|
||||
return False
|
||||
|
||||
basename = os.path.basename(path)
|
||||
if any(fnmatch.fnmatch(basename, ignore) for ignore in ignores):
|
||||
return False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue