diff options
Diffstat (limited to '')
-rwxr-xr-x | blogthon.cgi | 20 |
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: |