From de598420115593cc22d38e35b70b88268d559516 Mon Sep 17 00:00:00 2001 From: Stefan Ritter Date: Sat, 7 Mar 2009 15:57:49 +0100 Subject: [PATCH] Comments: * Comments are now shown under the entry when you click the permalink or the comments link --- blogthon.cgi | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/blogthon.cgi b/blogthon.cgi index 90b2f42..7a39863 100755 --- a/blogthon.cgi +++ b/blogthon.cgi @@ -132,26 +132,44 @@ else: # Show regular entry if post_display == title or not post_display: if allentries_display == "1" or entry_counter < entries_per_page: content = open(entry, "r") - if permalinks: + if permalinks: # Title as permalink... print '
' + title + ' (' + date + ')
' - else: + else: # ... or not print '
' + title + ' (' + date + ')
' print '

' for line in content: print ' ' + line.strip() + '
' + + # Comments are shown when post_display and comments_file + comments_file = glob.glob(entries_dir + title + '.comments') + if comments_file and post_display: + print '


' + comments_file = glob.glob(entries_dir + title + '.comments') + comments_content = open(comments_file[0], "r") + for line in comments_content: + if line.split(".", 1)[0] == "-": + print '
' + print ' ' + line.split(".", 1)[1] + ' wrote at ' + elif line.split(".", 1)[0] == "+": + print ' ' + line.split(".", 1)[1] + ':
' + else: + line = line.split(".", 1)[1] + print '   ' + line.strip() + '
' + comments_content.close() + if comments == "True": comments_file = glob.glob(entries_dir + title + '.comments') - if not comments_file: + if not comments_file and not post_display: print '
' - print ' ' + print ' ' print '

' - else: + elif comments_file and not post_display: comments_content = open(comments_file[0], "r") comments_counter = 0 for line in comments_content: if line.split(".", 1)[0] == "-": comments_counter += 1 print '
' comments_content.close()