aboutsummaryrefslogtreecommitdiffstats
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
parentd82d649c04dee4af95c0f13f478e697f92500f20 (diff)
First working version of clickable tags
-rwxr-xr-xblogthon.cgi18
1 files changed, 17 insertions, 1 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,6 +328,15 @@ if cname and ctext and ctitle:
# Read entries and store their title and timestamp
entries = []
+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:
@@ -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: