getpelican/pelican — pull request #1486 by foresto (2014-10-01 01:49:49+00:00)
Title: Ignore empty metadata

I originally set out to stop Pelican from creating files named `.html` when an empty `Slug:` line appeared in a Markdown file. While reading the code, I saw more opportunities for empty metadata to slip in, and noticed that someone had already reported a similar problem with `Tags:`. Since I don't know of any metadata that would make sense as empty strings, I decided to generalize my fix.

I essentially made two changes:
- `read_file()` now filters out metadata with non-true, non-numeric values. This takes care of of empty strings and lists without being destructive to `0` or `False` values that might be allowed some day. (It would also work with a class like `Category` if it grew a `__bool__()` method to indicate the presence of a real value.)
- The `Tags:` and `Authors:` metadata processors now omit empty values when creating their lists. If all their values are empty, they will return empty lists, which will be filtered out by `read_file()`.