commit 0efb3628d0f4e8c2001507443089f13c2d27c1c8
parent a4073496dc299d05d9ea2c609c407f9c51fa9cf2
Author: uriel@localhost.localdomain <unknown>
Date: Sat, 29 Nov 2008 16:20:08 +0100
Improve dirfilter, simplified and made more reliable. Also strip trailing * from ls -F output (not sure if this should be added to dirfilter itself.
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git 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 '<h1 class="dir-list-head">'^$"dt^'</h1> <ul class="dir-list">'
# XXX I'm not sure what the [^$] does there
- ls -F $d | sed -e $dirfilter' s,^'$sitedir'/.*/([^$].*),<li><a href="\1">\1</a></li>,'
+ ls -F $d | sed -e 's/\*$//; '^$dirfilter' s,^'$sitedir'/.*/([^$].*),<li><a href="\1">\1</a></li>,'
echo '</ul>'
}