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"
This commit is contained in:
Stefan Ritter 2009-03-03 18:43:37 +01:00
parent e96ea7f073
commit 728ee7d277

View File

@ -140,14 +140,21 @@ else: # Show regular entry
for line in content: for line in content:
print ' ' + line.strip() + '<br />' print ' ' + line.strip() + '<br />'
if comments == "True": 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 ' <div class="comment">'
print ' <ul><li><a href=? class="comment">no comments</a></li></ul>' print ' <ul><li><a href=? class="comment">no comments</a></li></ul>'
print ' </div><br />' print ' </div><br />'
else: 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 ' <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 />' print ' </div><br />'
comments_content.close()
print ' </p></div>' print ' </p></div>'
print ' <br /><br />' print ' <br /><br />'