From e606d0bc520cb435c151fbd63b3aa7056cd1cc81 Mon Sep 17 00:00:00 2001 From: Uriel Date: Wed, 13 Jun 2007 12:13:49 +0200 Subject: [PATCH] Titles for individual blog posts --- bin/controller.rc | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/bin/controller.rc b/bin/controller.rc index ca31972..8ec298c 100755 --- a/bin/controller.rc +++ b/bin/controller.rc @@ -71,10 +71,19 @@ fn sortedBlogPostList { 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 @@ fn genbody { echo '

'$"blogTitle'

' echo '
(rss feed)
' 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 @@ if (! ~ $args '') { 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 }