Fix the bug of archives

This commit is contained in:
Grégory Soutadé 2012-08-04 20:46:32 +02:00
parent 4277d28c9d
commit 3f8390be16

View File

@ -23,6 +23,7 @@ class Archive(Index):
self.nb_pages = 0
self.cur_page = 0
self.cur_article = 0
if len(articles) > self.articles_per_page:
self.nb_pages = len(articles) / self.articles_per_page
@ -91,6 +92,7 @@ class Archive(Index):
if i < nb_articles-1:
if articles[i].creation_date.year != articles[i+1].creation_date.year:
dom = parse(src + '/_archive.html')
self.createArchives(src, output, dom, hooks, my_articles)
self.cur_year = int(articles[i+1].creation_date.year)
#print 'New year ' + str(self.cur_year)
@ -100,6 +102,7 @@ class Archive(Index):
else:
my_articles.append(articles[i])
else:
# Last article
my_articles.append(article)
if nb_articles != 1 and articles[i].creation_date.year != articles[i-1].creation_date.year:
self.cur_year = int(articles[i].creation_date.year)