2 if(~ $#blaghDirs 0 && ~ $local_path */[bB]log/index*)
5 # Should not match sub-dirs!
6 if(! ~ $#blaghDirs 0) {
7 # && test -d / `{echo '-a -d '^$req_path^$blaghDirs}
8 blagh_uri=`{echo $req_path|sed 's/index(\.(atom|rss))?$//'}
9 blagh_url=$base_uri^$blagh_root_path
10 blagh_root=$sitedir^$blagh_uri
12 # XXX This is a hideous hack, blogs in dirs that match the number patern wont work, and dirs inside posts (eg., comments) wont work either.
13 # The problem is how to find out the 'root' of this blog, blaghDirs is useless for that.
14 if(~ $req_path */ && ! ~ $req_path */[0-9][0-9][0-9][0-9]/ */[0-9][0-9][0-9][0-9]/[0-9][0-9]/ */[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]/*) {
15 handler_body_main=blagh_body
17 extraHeaders=$"extraHeaders ^ \
18 '<link rel="alternate" type="application/rss+xml" title="RSS" href="'$"u'.rss" />
19 <link rel="alternate" type="application/atom+xml" title="ATOM" href="'$"u'.atom" />'
22 if not if(~ $req_path */index.atom)
23 blagh_setup_feed_handlers atom.tpl
24 if not if(~ $req_path */index.rss)
25 blagh_setup_feed_handlers rss20.tpl
29 fn blagh_setup_feed_handlers {
30 handler_body_main=NOT_USED_by_blagh_feeds
32 master_template=_apps/blagh/$1
36 for(p in `{get_post_list $blagh_root^$blaghDirs}) {
37 l=`{echo -n $p|sed 's!'$sitedir^$req_path'!!'}
38 sed '1s!.*!' < $p/index.md | $formatter
43 # the /./->/|/ are added so we can sort -t| and order only the file name
44 # NOTE: this breaks if any path element in blogDirs contain '/./' or '|'
45 ls -F $*^/./[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]/ >[2]/dev/null | sed -n '/'^$forbidden_uri_chars^'/d; s,/\./,/|/,; /\/$/p' | sort -r '-t|' +1 | sed 's,/+\|/+,/,'
50 if(! ~ 0 $#1 $#2 $#3) {
57 for(f in $bdir^$date^'-'*) {
58 i=`{echo -n $f | sed -n 's,^.*/'$date'-([0-9]+)_.*,\1,p'|tr -d $NEW_LINE}
59 if(! ~ $#i 0 && test $i -ge $n)
62 btitle=`{echo -n $"btitle | sed 's/[ ]+/_/g; 1q'}
64 echo $btext > $bdir^'/'^$"date^'-'^$"n^_$"btitle.md
67 status=Missing blog post arguments $"1 $"2 $"3