changeset 1:90ac20f6813e

comments
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Fri, 30 Jan 2009 02:48:56 -0500
parents e6b1128bc065
children 57d21fe2c053
files common-foot.sh common-head.sh story.cgi templates/story-comment-head.html templates/story-comment-item-head.html templates/story-comment-item-tail.html templates/story-comment-tail.html
diffstat 7 files changed, 33 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/common-foot.sh	Fri Jan 30 01:06:19 2009 -0500
+++ b/common-foot.sh	Fri Jan 30 02:48:56 2009 -0500
@@ -13,7 +13,7 @@
 "
 done
 cat templates/sidebar-middle.html
-for archname in data/by-month/* ; do
+for archname in `ls data/by-month/ | sort -r` ; do
 	archname=`basename $archname`
 
 	cat templates/sidebar-archive-item.html | sed -e "
--- a/common-head.sh	Fri Jan 30 01:06:19 2009 -0500
+++ b/common-head.sh	Fri Jan 30 02:48:56 2009 -0500
@@ -44,11 +44,12 @@
 cat_post()
 {
 #/^<!--more-->$/ { exit; }
+#{ print "<br/>" }
 	cat "$1" | awk '
 BEGIN { par=1 }
 (par) { print "<p>"; par=0 }
 { print $0 }
-/^$/ { print "</p>"; par=1 }
+/^$/ { print "</p>"; par=1; next }
 END { if (!par) print "</p>" }
 '
 }
--- a/story.cgi	Fri Jan 30 01:06:19 2009 -0500
+++ b/story.cgi	Fri Jan 30 02:48:56 2009 -0500
@@ -34,6 +34,24 @@
 cat_post "$fn"
 
 cat templates/story-bottom.html
+cat templates/story-comment-head.html | sed -e "
+s|@@COMCOUNT@@|`ls data/posts/$postid/comments/|wc -l`|g
+"
+
+for cmtid in `ls data/posts/$postid/comments | sort -n`; do
+	cat templates/story-comment-item-head.html | sed -e "
+s|@@COMID@@|$cmtid|g
+"
+	cat_post "data/posts/$postid/comments/$cmtid/text.txt"
+	cat templates/story-comment-item-tail.html | sed -e "
+s|@@COMID@@|$cmtid|g
+s|@@COMAUTHOR@@|`get_xattr author data/posts/$postid/comments/$cmtid/`|g
+s|@@COMDATE@@|`get_date data/posts/$postid/comments/$cmtid/`|g
+s|@@COMTIME@@|`get_time data/posts/$postid/comments/$cmtid/`|g
+"
+done
+
+cat templates/story-comment-tail.html
 
 ##########################
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/story-comment-head.html	Fri Jan 30 02:48:56 2009 -0500
@@ -0,0 +1,7 @@
+
+<h2 id="comments">@@COMCOUNT@@ Comments 
+	<a href="#postcomment" title="Leave a comment">&raquo;</a>
+
+</h2>
+
+<ol id="commentlist">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/story-comment-item-head.html	Fri Jan 30 02:48:56 2009 -0500
@@ -0,0 +1,1 @@
+	<li id="comment-@@COMID@@">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/story-comment-item-tail.html	Fri Jan 30 02:48:56 2009 -0500
@@ -0,0 +1,3 @@
+	<p><cite>Comment by @@COMAUTHOR@@ &#8212; @@COMDATE@@ @ <a href="#comment-@@COMID@@">@@COMTIME@@</a></cite></p>
+	</li>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/story-comment-tail.html	Fri Jan 30 02:48:56 2009 -0500
@@ -0,0 +1,1 @@
+</ol>