From 1832258d470e81538b22afa4dc86c8806ba2ce10 Mon Sep 17 00:00:00 2001 From: Uriel Date: Sat, 29 Nov 2008 16:20:08 +0100 Subject: [PATCH] Improve dirfilter, simplified and made more reliable. Also strip trailing * from ls -F output (not sure if this should be added to dirfilter itself. --- bin/werc.rc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/werc.rc b/bin/werc.rc index c913c26..00c7599 100755 --- a/bin/werc.rc +++ b/bin/werc.rc @@ -22,7 +22,7 @@ fn gentitle { # Don't change var name or trailing ';', dirfilter might be changed from _werc/config! # TODO: Specify the canonical path input format handled by dirfilter -dirfilter = '/\/[._]/d; /'^$forbidden_uri_chars^'/d; /\/(robots\.txt|sitemap\.txt|index\.(md|html|txt|tpl))$/d; /_werc$/d; s,^\./,,; s,\.md$,,; s,\.html,,; s,\.txt,,; ' +dirfilter = '/\/[._]/d; /'^$forbidden_uri_chars^'/d; /\/(robots\.txt|sitemap\.txt|index\.(md|html|txt|tpl))$/d; /_werc\/?$/d; s,^\./,,; s,\.(md|html|txt)$,,; ' # To be used from config files fn hide_paths { @@ -39,7 +39,7 @@ fn menu { dirs = ( $dd $dirs ) } # Ignore stderr, last item in path might be a file that doesn't exist (eg., foo for foo.md) - ls -F $dirs >[2]/dev/null | sed 's/[@*]$//; '^$dirfilter|sort -u | awk -F/ ' + ls -F $dirs >[2]/dev/null | sed 's/\*$//; '^$dirfilter|sort -u | awk -F/ ' function p(x, y, s) { for( i=0; i < x-y; i+=1) print s @@ -125,7 +125,7 @@ fn dir_listing_handler { dt = `{echo $d|sed -e 's,.*//,,g' -e 's,/$,,' -e 's,/, / ,g'} echo '

'^$"dt^'

' }