aboutsummaryrefslogtreecommitdiffstats
path: root/blogthon.cgi
diff options
context:
space:
mode:
authorStefan Ritter <xeno@goliath.thehappy.de>2009-03-03 19:36:47 +0100
committerStefan Ritter <xeno@goliath.thehappy.de>2009-03-03 19:36:47 +0100
commit953be3681a80dd3222ada7a903f2a5cc4d8c28bb (patch)
tree48884048ffd5b903dfa5d0b7a46fed41f3f0c246 /blogthon.cgi
parentf1f8235cb38a254e97e0dc7e1b19631000972649 (diff)
parente862ea3c45dfdaf59ace5272d1ae6e7b4bbc64ca (diff)
Merge branch 'master' of http://git.fucktheforce.de/blogthon
Diffstat (limited to 'blogthon.cgi')
-rwxr-xr-xblogthon.cgi20
1 files changed, 16 insertions, 4 deletions
diff --git a/blogthon.cgi b/blogthon.cgi
index dc34572..bc02a02 100755
--- a/blogthon.cgi
+++ b/blogthon.cgi
@@ -140,10 +140,22 @@ else: # Show regular entry
for line in content:
print ' ' + line.strip() + '<br />'
if comments == "True":
- print ' <div class="comment">'
- print ' <ul><li><a href=? class="comment">comments</a></li></ul>'
- print ' </div><br />'
-
+ comments_file = glob.glob(entries_dir + title + '.comments')
+ print str(comments_file)
+ if not comments_file:
+ print ' <div class="comment">'
+ print ' <ul><li><a href=? class="comment">no comments</a></li></ul>'
+ print ' </div><br />'
+ else:
+ comments_content = open(comments_file[0], "r")
+ comments_counter = 0
+ for line in comments_content:
+ if line.split(".", 1)[0] == "-": comments_counter += 1
+ print ' <div class="comment">'
+ print ' <ul><li><a href=? class="comment">comments (' + str(comments_counter) + ')</a></li></ul>'
+ print ' </div><br />'
+ comments_content.close()
+
print ' </p></div>'
print ' <br /><br />'
content.close()