getpelican/pelican — pull request #1352 by gw0 (2014-05-18 21:26:27+00:00)
Title: Add regular expressions support into STATIC_PATHS.

Documentation is describing that it is possible that other posts and images may be sitting alongside the current post, but for images and other non-article or non-page content this is not entirely true. By specifying ``STATIC_PATHS`` it is only possible to specify whole paths that will get copied, not files stored alongside any article or page.

Therefore I quickly implemented regular expressions support for STATIC_PATHS. As can be seen from the code previous behavior remains the same (if specified whole path or file exists it is used), but in case you specify a regexp or something that doesn't exists, the whole directory tree is traversed searching for matching paths.

Example usage:

content/article1/index.md -- with: ![pic1]({filename}img/pic1.jpg)
content/article1/img/pic1.jpg
content/article1/img/pic2.jpg

STATIC_PATHS = [
'.*/img$',
]

Although my initial opinion is that directory/file inclusion and exclusion related code needs some refactoring.