Fix #21: Add a setting for the archive order (REVERSE_ARCHIVE_ORDER)

This commit is contained in:
Alexis Metaireau 2010-12-14 15:55:26 +00:00
commit 3e9b80e993
3 changed files with 4 additions and 1 deletions

View file

@ -50,6 +50,8 @@ Setting name what it does ?
(no rss)
`CSS_FILE` To specify the CSS file you want to load, if it's not
the default one ('main.css')
`REVERSE_ARCHIVE_ORDER` Reverse the archives order. (True makes it in
descending order: the newer first)
======================= =======================================================
Themes

View file

@ -158,7 +158,7 @@ class ArticlesGenerator(Generator):
# sort the articles by date
self.articles.sort(key=attrgetter('date'), reverse=True)
self.dates = list(self.articles)
self.dates.sort(key=attrgetter('date'))
self.dates.sort(key=attrgetter('date'), reverse=self.context['REVERSE_ARCHIVE_ORDER'])
# and generate the output :)
self._update_context(('articles', 'dates', 'tags', 'categories'))

View file

@ -16,6 +16,7 @@ _DEFAULT_CONFIG = {'PATH': None,
'DEFAULT_CATEGORY': 'misc',
'FALLBACK_ON_FS_DATE': True,
'CSS_FILE': 'main.css',
'REVERSE_ARCHIVE_ORDER': False,
}
def read_settings(filename):