From: Oleg Broytman Date: Wed, 8 Mar 2006 20:48:52 +0000 (+0000) Subject: Show tags in the blog index. X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=44e9fd6fc036d39af7f1000a9a1a57b1e9ebb6ad;p=phdru.name%2Fphdru.name.git Show tags in the blog index. git-svn-id: file:///home/phd/archive/SVN/phdru.name/scripts@22 7bb0bf08-9e0d-0410-b083-99cee3bf18b8 --- diff --git a/reindex_blog.py b/reindex_blog.py index 4451baa..45faac2 100755 --- a/reindex_blog.py +++ b/reindex_blog.py @@ -116,7 +116,7 @@ def write_if_changed(filename, new_text): outfile.close() -def write_template(level, year, month, day, titles): +def write_template(level, year, month, day, titles, tags=None): path = [] if level >= 1: path.append(year) @@ -231,12 +231,26 @@ def write_template(level, year, month, day, titles): years = {} for year, month, day, file, title, lead in save_titles: years[year] = True - first_year = True new_text.append('''
-

+

ôÅÇÉ: +''') + first_tag = True + for count, tag, links in all_tags: + if first_tag: + first_tag = False + else: + new_text.append(' - ') + new_text.append("""%s (%d)""" % (tag, tag, count)) + new_text.append(''' +

''') + + new_text.append(''' +

ðÏ ÇÏÄÁÍ: +''') + first_year = True for year in sorted(years.keys()): if first_year: first_year = False @@ -283,11 +297,12 @@ for year in sorted(years.keys()): write_template(3, year, month, day, day_titles) write_template(2, year, month, day, month_titles) write_template(1, year, month, day, year_titles) -write_template(0, year, month, day, all_titles[-20:]) all_tags = [(len(links), tag, links) for (tag, links) in all_tags.items()] all_tags.sort() +write_template(0, year, month, day, all_titles[-20:], all_tags) + new_text = ["""\ ## THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. #extends phd_pp_ru