diff --git a/bin/controller.rc b/bin/controller.rc index dbd940f..a8796ac 100755 --- a/bin/controller.rc +++ b/bin/controller.rc @@ -8,8 +8,8 @@ ifs='/' { cd .. # default config -formater=markdown.pl -formater=md_cache # markdown cacher +formatter=markdown.pl +formatter=md_cache # markdown cacher site=$SERVER_NAME sitedir=sites/$site headers=inc/headers.tpl @@ -31,9 +31,11 @@ dirfilter = '/\/[._]/d; s,^\./,,; s,\.md$,,; s,\.html,,;' # Sidebar fn menu { lsArgs = ( '-F' ) - if (! ~ $#blogDirs 0) { + # XXX will not work properly for $#blogDirs > 1 and matching is hackish + if ( (!~ $#inBlog 0) || ! ~ $#blogDirs 0 && (~ $blogDirs^/ *$1 *$1/) ) { # Work in progress XXX lsArgs = ($lsArgs -r) } + ls $lsArgs $1 | sed $dirfilter | awk -F/ ' BEGIN { print "" } @@ -88,8 +90,8 @@ fn blogTitle { fn genbody { if ( test -f $body.md ) { if ( ! ~ $#inBlog 0 ) - blogTitle $body.md | $formater - $formater < $body.md + blogTitle $body.md | $formatter + $formatter < $body.md } if not if ( test -f $body.tpl ) template.awk $body.tpl | rc $rcargs @@ -107,13 +109,15 @@ fn genbody { ls -F `{ basename -d $body } | sed -e $dirfilter' s,^'$sitedir'/.*/([^$].*),
  • \1
  • ,' echo '' } - if not if(~ $#blogDirs 0) + if not if(~ $#blogDirs 0) { + #echo 'Status: 404 Not Found\n\n' # should go before starting to print body template.awk inc/404.tpl | rc $rcargs + } if(! ~ $#blogDirs 0) { if ( ! ~ $blogTitle '' ) echo '

    '$"blogTitle'

    ' - echo '
    (rss feed)
    ' + echo '
    (rss feed)
    ' for ( f in `{ sortedBlogPostList $blogDirs } ) { #title=`{basename $f | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' } #du=`{ls -l $f} @@ -121,7 +125,7 @@ fn genbody { blogTitle $f cat $f echo - } | $formater + } | $formatter } } @@ -136,7 +140,7 @@ if (! ~ $args '') { } fpath=$sitedir -for ( i in '' $args ) { +for ( i in ('' $args) ) { fpath = $fpath/$i # We don't want blog settings to cascade into posts, note that we are inBlog instead if ( ! ~ $#blogDirs 0 && ! ~ $body */indexrss */[bB]log */[bB]log/ ) { @@ -167,7 +171,7 @@ if(! ~ $#blogDirs 0) { rssuri=`{basename -d $uri} rssuri=$baseuri`{cleanname $"rssuri^/index.rss} extraHeaders=$"extraHeaders ^ \ - ' + ' ' } @@ -221,20 +225,21 @@ cat <<'!' | template Content-Type: text/xml; charset=utf-8 - + + %($siteTitle%) %($uri%) %($blogDesc%) en-us Tom Duff's rc, and Kris Maglione's clever hackery - Uriel Mangado <uriel99@gmail.com> + uriel99+rss@gmail.com (Uriel) %{ for(f in `{sortedBlogPostList $blogDirs}) { statpost $f %} %($title%) - %($by%)@noreply.cat-v.org + %($by%)@noreply.cat-v.org (%($by%)) %($uri%) %($uri%) %($date%) @@ -244,4 +249,3 @@ Content-Type: text/xml; charset=utf-8 ! -