getpelican/pelican — pull request #662 by wking (2013-01-03 19:06:52+00:00)
Title: contents: Add rich comparisons to URLWrapper for easy sorting

There have been earlier attempts to sort categories and authors
[1,2,3], but they either sorted based on the object id [3], or only sorted
the main author and categories list.

This patch uses rich comparisons (keyed off URLWrapper.name, but easily
adjustable in subclasses) to make the objects sortable without specifying a
key for each sort. For example, now

{% for tag, articles in tags|sort %}

works as expected in a Jinja template.

[1]: 877d454c8fa979343d4881a00977d9ac8786f178
[2]: 7f36e0ed20745c73886d96d4af303b0d858b8a53
[3]: d0ec18f4dbd623c55bdf4928ee7c363f699ef696