forked from github/pelican
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.
The functools.total_ordering decorator fills in the missing rich
comparisons [4,5].
[1]:
|
||
|---|---|---|
| .. | ||
| plugins | ||
| themes | ||
| tools | ||
| __init__.py | ||
| contents.py | ||
| generators.py | ||
| log.py | ||
| paginator.py | ||
| readers.py | ||
| rstdirectives.py | ||
| server.py | ||
| settings.py | ||
| signals.py | ||
| utils.py | ||
| writers.py | ||