From: Oleg Broytman Date: Tue, 20 May 2014 14:47:58 +0000 (+0400) Subject: В индексе блога в разбивке по годам показывать кол-во записей X-Git-Url: https://git.phdru.name/?p=phdru.name%2Fphdru.name.git;a=commitdiff_plain;h=e12ad79a4afa786eeaa2665dc1888b96e896a2b1 В индексе блога в разбивке по годам показывать кол-во записей --- diff --git a/reindex_blog.py b/reindex_blog.py index 197c1c6..645dd82 100755 --- a/reindex_blog.py +++ b/reindex_blog.py @@ -264,13 +264,20 @@ def write_template(level, year, month, day, titles, tags=None): new_text.append('''

ðÏ ÇÏÄÁÍ: ''') + + year_counts = {} + for year, month, day, file, title, lead in all_titles: + year_counts[year] = 0 + for year, month, day, file, title, lead in all_titles: + year_counts[year] += 1 + first_year = True for year in years: if first_year: first_year = False else: new_text.append(' - ') - new_text.append('%s' % (year, year)) + new_text.append('%s (%d)' % (year, year, year_counts[str(year)])) new_text.append('''

''')