aboutsummaryrefslogtreecommitdiffstats
path: root/blogthon.cgi
diff options
context:
space:
mode:
authorStefan Ritter <xeno@thehappy.de>2012-01-21 02:47:45 +0100
committerStefan Ritter <xeno@thehappy.de>2012-01-21 02:47:45 +0100
commitae794083b2caae0551bfa357594a7a27e684bd58 (patch)
tree8bba84580f050e57f859e1e9a76f50c8871551b6 /blogthon.cgi
parentd82d649c04dee4af95c0f13f478e697f92500f20 (diff)
First working version of clickable tags
Diffstat (limited to '')
-rwxr-xr-xblogthon.cgi20
1 files changed, 18 insertions, 2 deletions
diff --git a/blogthon.cgi b/blogthon.cgi
index 9217901..786db74 100755
--- a/blogthon.cgi
+++ b/blogthon.cgi
@@ -253,6 +253,7 @@ if post_display:
allentries_display = action.getvalue("a")
feed_display = action.getvalue("feed")
+tag_display = action.getvalue("t")
if not month_display:
month_display = ""
@@ -269,6 +270,9 @@ if not allentries_display:
if not feed_display:
feed_display = ""
+if not tag_display:
+ tag_display = ""
+
ctitle = action.getvalue("ctitle")
cname = action.getvalue("cname")
ctext = action.getvalue("ctext")
@@ -324,7 +328,16 @@ if cname and ctext and ctitle:
# Read entries and store their title and timestamp
entries = []
-entries_list = glob(os.path.join(entries_dir, "*." + entries_suffix))
+if tag_display != "":
+ entries_list = []
+ tagfile = open(os.path.join(entries_dir, "tags"), "r")
+ tagindex = pickle.load(tagfile)
+ tagfile.close()
+ for tag in tagindex:
+ if tag[0] == tag_display:
+ entries_list.append(tag[1])
+else:
+ entries_list = glob(os.path.join(entries_dir, "*." + entries_suffix))
for entry in entries_list:
title = entry.replace(entries_dir, "", 1)
@@ -625,7 +638,10 @@ else:
# Read tags
tagline = content.readline().strip()
if re.match(line_start_plus, tagline):
- tagline = tagline.replace("+", "")
+ tagline_items = tagline.split("+")
+ tagline = ""
+ for tag in tagline_items:
+ tagline += "<a href=\"%s?t=%s\">%s</a> " % (blog_url, tag, tag)
if tags == "True":
print(ind*4 + "<div class=\"tags\"><b>Tags:</b> %s</div>" % tagline)
else: