diff options
author | Stefan Ritter <xeno@goliath.thehappy.de> | 2009-03-07 15:57:49 +0100 |
---|---|---|
committer | Stefan Ritter <xeno@goliath.thehappy.de> | 2009-03-07 15:57:49 +0100 |
commit | de598420115593cc22d38e35b70b88268d559516 (patch) | |
tree | 9a26a064ce939302cb252bc6a9d95109ec8b6da3 /blogthon.cgi | |
parent | 622aec5badede447a477aeeca07e0608821ced49 (diff) |
Comments:
* Comments are now shown under the entry when you click the permalink or the
comments link
Diffstat (limited to 'blogthon.cgi')
-rwxr-xr-x | blogthon.cgi | 30 |
1 files 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 ' <div class="entrytitle"><a href="?p=' + title + '" class="entrytitle">' + title + ' <small>(' + date + ')</small></a></div>' - else: + else: # ... or not print ' <div class="entrytitle">' + title + ' <small>(' + date + ')</small></div>' print ' <div class="entry"><p>' for line in content: print ' ' + line.strip() + '<br />' + + # Comments are shown when post_display and comments_file + comments_file = glob.glob(entries_dir + title + '.comments') + if comments_file and post_display: + print ' <br><hr>' + 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 ' <br />' + print ' <i>' + line.split(".", 1)[1] + '</i><small> wrote at ' + elif line.split(".", 1)[0] == "+": + print ' ' + line.split(".", 1)[1] + ':</small><br />' + else: + line = line.split(".", 1)[1] + print ' ' + line.strip() + '<br />' + 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 ' <div class="comment">' - print ' <ul><li><a href=? class="comment">no comments</a></li></ul>' + print ' <ul><li><a href="?p=' + title + '" class="comment">no comments</a></li></ul>' print ' </div><br />' - 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 ' <div class="comment">' - print ' <ul><li><a href=? class="comment">comments (' + str(comments_counter) + ')</a></li></ul>' + print ' <ul><li><a href="?p=' + title + '" class="comment">comments (' + str(comments_counter) + ')</a></li></ul>' print ' </div><br />' comments_content.close() |