getpelican/pelican — pull request #671 by wking (2013-01-05 20:36:00+00:00)
Title: generators: Add `ContentGenerator` subclass

This takes the heavy lifting our of `ArticlesGenerator`,
`PagesGenerator`, and `StaticGenerator` to ease maintenance and
promote consistent handling. A whole bunch of annoying
inconsistencies between these generators are either more explicit or
gone.

Unfortunately, everything that relied on those inconsistencies is now
broken. See my changes to the bundled templates for examples. The
fixes are a bit tedious, but once inplemented they should reduce the
mental overhead of maintaining a theme, because context information is
now more consistently tied to the underlying `ContentGenerator`
behaviour.

This builds on top of my earier #667 (included in this PR) and cherry
picks one commit from #665, both of which it supersedes. I'll leave
those PRs open for now though, because this one does a lot of other
stuff too, and might therefore take a bit longer to get merged ;). I
can always rebase this as bits of it get merged into `master`.

TODO:

* Document the new settings, and the fallback setting approach.
* See about unifying the other `Generator` subclasses.
* Possibly rewrite `ContentGenerator._context_processors` and
`ContentGenerator._generators` initialization to be less ad-hoc.

I'm pushing the PR now to get high-level feedback. Don't bother
giving very specific advice until the general thrust is worked out,
since there may be some major rebases still on the way.