Move trailing * executable market strpping to dirfilter.
All dirfilter users need it so far, and we should not allow * in file names anyway.
This commit is contained in:
parent
abb5df1d32
commit
4c56c67284
10
bin/werc.rc
10
bin/werc.rc
@ -9,9 +9,9 @@ fn get_lib_file {
|
||||
if(test -f $sitedir/_werc/lib/$1)
|
||||
echo -n $sitedir/_werc/lib/$1
|
||||
if not if(! ~ $#masterSite 0 && test -f $sitesdir/$masterSite/_werc/lib/$1)
|
||||
echo -n $sitesdir/$masterSite/_werc/lib/$1
|
||||
echo -n $sitesdir/$masterSite/_werc/lib/$1
|
||||
if not if(test -f lib/$1)
|
||||
echo -n lib/$1
|
||||
echo -n lib/$1
|
||||
}
|
||||
|
||||
# Title
|
||||
@ -21,7 +21,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='s,/+\./+,/,g; /\/[._]/d; /'^$forbidden_uri_chars^'/d; /^\/(robots|sitemap)\.txt$|\/index\.(md|html|txt|tpl)$/d; /_werc\/?$/d; s,^\./,,; s,\.(md|html|txt)$,,; '
|
||||
dirfilter='s/\*$//; s,/+\./+,/,g; /\/[._]/d; /'^$forbidden_uri_chars^'/d; /^\/(robots|sitemap)\.txt$|\/index\.(md|html|txt|tpl)$/d; /_werc\/?$/d; s,^\./,,; s,\.(md|html|txt)$,,; '
|
||||
|
||||
# To be used from config files
|
||||
fn hide_paths {
|
||||
@ -36,7 +36,7 @@ fn gensidebar {
|
||||
dirs=( $sitedir^$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/\*$//; s,^'$sitedir',,; '^$dirfilter | sort -u | awk -F/ '
|
||||
ls -F $dirs >[2]/dev/null | sed 's,^'$sitedir',,; '^$dirfilter | sort -u | awk -F/ '
|
||||
function p(x, y, s) {
|
||||
for(i=0; i < x-y; i+=1)
|
||||
print s
|
||||
@ -94,7 +94,7 @@ fn dir_listing_handler {
|
||||
d=`{basename -d $1}
|
||||
echo $d|sed 's,.*//,,g; s,/$,,; s,/, / ,g; s,.*,<h1 class="dir-list-head">&</h1> <ul class="dir-list">,'
|
||||
# Symlinks suck: '/.' forces ls to list the linked dir if $d is a symlink.
|
||||
ls -F $d/. | sed 's/\*$//; '^$dirfilter' s,.*/([^/]+/?)$,<li><a href="\1">\1</a></li>,'
|
||||
ls -F $d/. | sed $dirfilter' s,.*/([^/]+/?)$,<li><a href="\1">\1</a></li>,'
|
||||
echo '</ul>'
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user