From 3a0f4beaae5055b8e21e321482ad927afd2e3e00 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Mon, 31 May 2010 21:12:00 -0300 Subject: [PATCH] Add links to available tags --- blitiri.cgi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/blitiri.cgi b/blitiri.cgi index bce7765..78ee66b 100755 --- a/blitiri.cgi +++ b/blitiri.cgi @@ -192,6 +192,7 @@ default_main_footer = """ years: %(yearlinks)s
subscribe: atom
views: blog list
+ tags: %(taglinks)s
@@ -583,6 +584,7 @@ class Templates (object): 'showyear': showyear, 'monthlinks': ' '.join(db.get_month_links(showyear)), 'yearlinks': ' '.join(db.get_year_links()), + 'taglinks': ' '.join(db.get_tag_links()), } def get_template(self, page_name, default_template, extra_vars = None): @@ -967,6 +969,7 @@ class ArticleDB (object): self.uuids = {} self.actyears = set() self.actmonths = set() + self.acttags = set() self.load() def get_articles(self, year = 0, month = 0, day = 0, tags = None): @@ -1004,6 +1007,7 @@ class ArticleDB (object): datetime.datetime.fromtimestamp(float(l[1])), datetime.datetime.fromtimestamp(float(l[2]))) self.uuids[a.uuid] = a + self.acttags.update(a.tags) self.actyears.add(a.created.year) self.actmonths.add((a.created.year, a.created.month)) self.articles.append(a) @@ -1038,6 +1042,12 @@ class ArticleDB (object): ml.append(s) return ml + def get_tag_links(self): + tl = list(self.acttags) + tl.sort() + return [ '%s' % (blog_url, + sanitize(t), sanitize(t)) for t in tl ] + # # Main # -- 2.43.0