--- bin/handlers.rc | 8 ++++++-- bin/werc.rc | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/handlers.rc b/bin/handlers.rc index 2055ed4..b68cff6 100644 --- a/bin/handlers.rc +++ b/bin/handlers.rc _AT_@ -1,5 +1,9 @@ # Werc builtin handlers +suffixes=(md 1 tpl) + +suffix_alternation='('^`{echo $"suffixes | tr ' ' '|'}^')' + fn nav_tree { echo '<ul>' if(! ~ $#menuTitle 0) { _AT_@ -12,7 +16,7 @@ fn nav_tree { # /./ to deal with p9p's ls failure to follow dir symlinks otherwise ls -F $sitedir/./$req_paths_list >[2]/dev/null \ | { - sed $dirfilter'/\/[^_.\/][^\/]*(\.(md|1)|\/)$/!d; s!^'$sitedir'!!; '$dirclean + sed $dirfilter'/\/[^_.\/][^\/]*(\.'^$suffix_alternation^'|\/)$/!d; s!^'$sitedir'!!; '$dirclean if(! ~ $#synth_paths 0) echo $synth_paths | tr ' ' $NEW_LINE } | sort -u | awk -F/ ' function p(x, y, s) { for(i=0; i < x-y; i+=1) print s } _AT_@ -70,7 +74,7 @@ fn dir_listing_handler { fn setup_handlers { local_file=() - for(suffix in md 1 tpl) if(test -f $local_path.$suffix) { + for(suffix in $suffixes) if(test -f $local_path.$suffix) { local_file=$local_path.$suffix handler_body_main=($suffix^_handler $local_file) } diff --git a/bin/werc.rc b/bin/werc.rc index 01f4714..dd77207 100755 --- a/bin/werc.rc +++ b/bin/werc.rc _AT_@ -9,8 +9,8 @@ difs=$ifs # Used to restore default ifs when needed # Expected input: ls -F style, $sitedir/path/to/files/ # <ls -F+x><symlink hack><Useless?><hiden files > -dirfilter='s/\*$//; s,/+\./+,/,g; s,^\./,,; /\/[._][^\/]/d; /'$forbidden_uri_chars'/d; /\/sitemap\.xml$/d; /\/index\.(md|tpl)$/d; /\/(robots|sitemap)\.txt$/d; /_werc\/?$/d; ' -dirclean=' s/\.(md|1)$//; ' +dirfilter='s/\*$//; s,/+\./+,/,g; s,^\./,,; /\/[._][^\/]/d; /'$forbidden_uri_chars'/d; /\/sitemap\.xml$/d; /\/index(\.'^$suffix_alternation^')+$/d; /\/(robots|sitemap)\.txt$/d; /_werc\/?$/d; ' +dirclean=' s/\.'^$suffix_alternation^'$//; ' # Careful, the proper p9p path might not be set until initrc.local is sourced path=(. $PLAN9/bin ./bin /bin /usr/bin) -- 1.7.11.1Received on Mon Sep 17 2001 - 00:00:00 CEST
This archive was generated by hypermail 2.3.0 : Thu Jul 04 2013 - 04:12:04 CEST