Fix and simplify config loading process.

This commit is contained in:
Uriel 2009-01-23 16:46:48 +01:00
parent 61be624c8c
commit d7bb2ec271

View file

@ -13,8 +13,7 @@ fn get_lib_file {
echo -n lib/$1 echo -n lib/$1
} }
# Don't change var name or trailing ';', dirfilter might be changed from _werc/config! # Expected input: ls -F style, $sitedir/path/to/files/
# ls -F style input of the form: $sitedir/path/to/files/
# <ls -F+x><symlink hack><Useless?><hiden files > # <ls -F+x><symlink hack><Useless?><hiden files >
dirfilter='s/\*$//; s,/+\./+,/,g; s,^\./,,; /\/[._][^\/]/d; /'^$forbidden_uri_chars^'/d; /^\/(robots|sitemap)\.txt$|\/index\.(md|html|txt|tpl)$/d; /_werc\/?$/d; ' dirfilter='s/\*$//; s,/+\./+,/,g; s,^\./,,; /\/[._][^\/]/d; /'^$forbidden_uri_chars^'/d; /^\/(robots|sitemap)\.txt$|\/index\.(md|html|txt|tpl)$/d; /_werc\/?$/d; '
dirclean=' s/\.(md|html|txt)$//; ' dirclean=' s/\.(md|html|txt)$//; '
@ -184,13 +183,15 @@ if not if(test -d $local_path)
perm_redirect $req_path^'/' perm_redirect $req_path^'/'
cd $sitedir cd $sitedir
req_paths_list='/' # Note: req_paths_list doesn't include 'stnythetic' dirs.
conf_wd='/' # Used in config files to know where we are in the document tree.
if(test -f _werc/config) if(test -f _werc/config)
. _werc/config . _werc/config
conf_wd='' # This can be used inside config files to know where we are in the document tree. for(i in $args) {
for(i in ('' $args)) { conf_wd=$conf_wd^$i
config_wd=($"config_wd^/^$i) req_paths_list=($req_paths_list $conf_wd)
req_paths_list=($req_paths_list $config_wd)
if(test -d $i) { if(test -d $i) {
conf_wd=$conf_wd^'/'
cd $i cd $i
if(test -f _werc/config) if(test -f _werc/config)
. _werc/config . _werc/config