new_text.append('''
<p class="head">По годам:
''')
+
+ 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('<a href="%s/">%s</a>' % (year, year))
+ new_text.append('<a href="%s/">%s (%d)</a>' % (year, year, year_counts[str(year)]))
new_text.append('''
</p>
''')