Fix the "period archives" feature.

The root of the problem was that I was updating the wrong item
in the context dict - `articles` as opposed to `dates`, as used
by archive templates.

I also reimplemented the feature in terms of `itertools.groupby`,
which is a more sensible (and efficient) approach than I used
initially.
Merge pelican/master