shithub: werc

Download patch

ref: cf8670035655eed236ef5d8b7a2dc4c144fdcb3e
parent: 473b4197d45bf4549748855045d72976553f3447
author: uriel <uriel@engel.se.cat-v.org>
date: Wed Jun 13 08:13:49 EDT 2007

Titles for individual blog posts

--- a/bin/controller.rc
+++ b/bin/controller.rc
@@ -71,10 +71,19 @@
         ls $*^'/./' | grep '[0-9]+.*\.md$'| sort -r -t. +1
 }
 
+fn blogTitle {
+    title=`{basename $1 | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' }
+    du=`{ls -l $1}
+    echo '##' $title '*('By $du(4) Last mod: $du(7 8 9) ')*'
+}
+
 # Body
 fn genbody {
-    if ( test -f $body.md )
+    if ( test -f $body.md ) {
+        if ( ! ~ $#inBlog 0 )
+            blogTitle $body.md | markdown.pl
         markdown.pl < $body.md
+    }
     if not if ( test -f $body.tpl )
         template.awk $body.tpl | rc $rcargs
     if not if ( test -f $body.html )
@@ -97,9 +106,10 @@
             echo '<h1>'$"blogTitle'</h1>'
 	echo '<div align="right">(<a href="index.rss">rss feed</a>)</div>'
         for ( f in `{ sortedBlogPostList $blogDirs } ) {
-            title=`{basename $f | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' }
-            du=`{ls -l $f}
-            echo '##' $title '*('By $du(4) Last mod: $du(7 8 9) ')*'
+            #title=`{basename $f | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' }
+            #du=`{ls -l $f}
+            #echo '##' $title '*('By $du(4) Last mod: $du(7 8 9) ')*'
+            blogTitle $f
             cat $f 
             echo 
         } | markdown.pl 
@@ -118,7 +128,11 @@
 fpath=$sitedir
 for ( i in '' $args ) {
     fpath = $fpath/$i
-    blogDirs = () # We don't want blog settings to cascade into posts
+    # We don't want blog settings to cascade into posts, note that we are inBlog instead
+    if ( ! ~ $#blogDirs 0 ) {
+        inBlog = $blogDirs
+        blogDirs = () 
+    }
     if ( test -f $fpath/_config )
         . $fpath/_config
 }