diff options
author | Stefan Ritter <xeno@thehappy.de> | 2009-03-03 18:43:37 +0100 |
---|---|---|
committer | Stefan Ritter <xeno@thehappy.de> | 2009-03-03 18:43:37 +0100 |
commit | 728ee7d2772f457d726a6b4d1dcfde9242187de4 (patch) | |
tree | b52a6b05f4d1fd876ec03ea8ffab03748e5077d5 | |
parent | e96ea7f073c9843f7aa6b842ee373aafb698ebeb (diff) |
Comments:
* Commentcounter added for commentlinks:
-. at the start of a line means "here is the header"
(better for splitting)
. at the start of a line means "i am a text"
-rwxr-xr-x | blogthon.cgi | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/blogthon.cgi b/blogthon.cgi index 1962d77..bc02a02 100755 --- a/blogthon.cgi +++ b/blogthon.cgi @@ -140,14 +140,21 @@ else: # Show regular entry for line in content: print ' ' + line.strip() + '<br />' if comments == "True": - if not glob.glob(entries_dir + title + '.comments'): + 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 (count)</a></li></ul>' + 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 />' |