---
bin/handlers.rc | 6 ++++--
bin/werc.rc | 12 +++++++-----
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/bin/handlers.rc b/bin/handlers.rc
index 2055ed4..e1e246d 100644
--- a/bin/handlers.rc
+++ b/bin/handlers.rc
_AT_@ -1,5 +1,7 @@
# Werc builtin handlers
+suffixes=(md 1 tpl)
+
fn nav_tree {
echo '<ul>'
if(! ~ $#menuTitle 0) {
_AT_@ -12,7 +14,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 +72,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..5fa22c3 100755
--- a/bin/werc.rc
+++ b/bin/werc.rc
_AT_@ -7,14 +7,16 @@ cd ..
forbidden_uri_chars='[^a-zA-Z0-9_+\-\/\.,:]'
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)$//; '
-
# Careful, the proper p9p path might not be set until initrc.local is sourced
path=(. $PLAN9/bin ./bin /bin /usr/bin)
+suffix_alternation='('^`{echo $"suffixes | tr ' ' '|'}^')'
+
+# 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(\.'^$suffix_alternation^')+$/d; /\/(robots|sitemap)\.txt$/d;
/_werc\/?$/d; '
+dirclean=' s/\.'^$suffix_alternation^'$//; '
+
http_content_type='text/html'
ll_add handlers_bar_left nav_tree
werc_root=`{pwd}
--
1.7.11.1
Received on Mon Sep 17 2001 - 00:00:00 CEST
This archive was generated by hypermail 2.3.0 : Thu Jul 04 2013 - 07:36:02 CEST