| Source _werc/config files with their container dir as working directory (allows… | |
| git clone git://git.suckless.org/swerc | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit a2ce64ea4c21f2c7e9dc0490009ce5b1a4ccfda8 | |
| parent 5bfbcdc27e7d9f4e3ffae6b55c9a6890bfe646f0 | |
| Author: [email protected] <unknown> | |
| Date: Sat, 27 Dec 2008 11:53:58 +0100 | |
| Source _werc/config files with their container dir as working directory (allows… | |
| Added two new global vars: $werc_root and $req_paths_list. | |
| Change sidebar menu generation to use $req_paths_list. | |
| Diffstat: | |
| M bin/werc.rc | 22 ++++++++++++---------- | |
| 1 file changed, 12 insertions(+), 10 deletions(-) | |
| --- | |
| diff --git a/bin/werc.rc b/bin/werc.rc | |
| @@ -31,12 +31,8 @@ fn hide_paths { | |
| # Sidebar | |
| fn gensidebar { | |
| - for(d in ./ $args) { | |
| - dd=$"dd^'/'^$d | |
| - dirs=( $sitedir^$dd $dirs ) | |
| - } | |
| # Ignore stderr, last item in path might be a file that doesn't exist (eg.… | |
| - ls -F $dirs >[2]/dev/null | sed 's,^'$sitedir',,; '^$dirfilter | sort -u |… | |
| + ls -F $sitedir^/./^$req_paths_list >[2]/dev/null | sed 's,^'$sitedir',,; '… | |
| function p(x, y, s) { | |
| for(i=0; i < x-y; i+=1) | |
| print s | |
| @@ -226,6 +222,7 @@ for(i in siteTitle siteSubTitle pageTitle extraHeaders) | |
| if(test -f etc/initrc.local) | |
| . ./etc/initrc.local | |
| +werc_root=`{pwd} | |
| # Parse request URL | |
| uri=`{echo -n $REQUEST_URI | sed 's/\?.*//; s/'^$forbidden_uri_chars^'//g; s/\… | |
| @@ -248,22 +245,27 @@ if not { | |
| req_path='/' | |
| } | |
| -fpath=$sitedir | |
| +p=() | |
| +cd $sitedir | |
| for(i in ('' $args)) { | |
| # TODO We can build a list of paths here that can be used in sidebar, inst… | |
| - fpath=$fpath/$i | |
| + p=($"p^/^$i) | |
| + req_paths_list=($req_paths_list $p) | |
| # We don't want blog settings to cascade into posts, note that we are inBl… | |
| if(! ~ $#blogDirs 0 && ! ~ $req_path */index.rss */index.atom */[bB]log */… | |
| inBlog = $blogDirs | |
| blogDirs = () | |
| } | |
| - | |
| - if(test -f $fpath/_werc/config) | |
| - . ./$fpath/_werc/config | |
| + if(test -d $i) { | |
| + cd $i | |
| + if(test -f _werc/config) | |
| + . _werc/config | |
| + } | |
| if(~ $#blogDirs 0 && ~ $#inBlog 0 && ~ $i [Bb]log) | |
| inBlog = 'yes' | |
| } | |
| +cd $werc_root | |
| # Redirections and other preprocessing | |
| if(~ $#redirectPermanent 1) |