shithub: werc

Download patch

ref: 2df0c21bc7a1e5454b20844e476f41cceddb3241
parent: 3bbe4cd657208807037ac3b86e164b3743813160
author: uriel <uriel@engel.se.cat-v.org>
date: Sun Jan 25 23:56:05 EST 2009

Only allow comments for .md files, this avoids silly things like comments for
loggin form pages, but will need to be improved to become more general.

Simplify some code a bit and cosmetic improvements.

--- a/apps/bridge/app.rc
+++ b/apps/bridge/app.rc
@@ -1,9 +1,7 @@
 fn bridge_init {
-    # XXX: Should avoid running for 404s, dir lists, etc.
-    if(! ~ $#enable_comments 0) {
-        ll_add handlers_body_foot bridge_body_foot 
+    if(! ~ $#enable_comments 0 && test -f $local_path.md) {
+        ll_add handlers_body_foot template apps/bridge/foot.tpl
         if(get_post_args comment_text) {
-            dprint POST COMMNET $"comment_text
             d=`{date -n} # FIXME Obvious race
             d=$local_path^'_werc/comments/'^$d/
 
@@ -27,9 +25,5 @@
         }
     }
 
-}
-
-fn bridge_body_foot {
-    template apps/bridge/foot.tpl
 }
 
--- a/apps/bridge/foot.tpl
+++ b/apps/bridge/foot.tpl
@@ -2,8 +2,9 @@
 % if(test -d $cdir) { 
     <hr /><h2>Comments</h2>
 %    for(c in `{ls $cdir/}) {
-        <div>By: 
+        <div><b>By: <i> 
 %           cat $c/user
+            </i></b>
             <br />
 %           cat $c/body | escape_html | sed 's,$,<br />,'
         <hr /></div>