commit f5e8d668a6fe72d39d616542e3002640b4b738c6
parent 3e053defeba4af29ecfc903d8793dae254daa184
Author: uriel@engel.se.cat-v.org <unknown>
Date: Sun, 4 Jan 2009 07:57:13 +0100
Very minor dirfilter cleanups and some extra comments.
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/bin/werc.rc b/bin/werc.rc
@@ -20,8 +20,9 @@ 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/\*$//; s,/+\./+,/,g; /\/[._]/d; /'^$forbidden_uri_chars^'/d; /^\/(robots|sitemap)\.txt$|\/index\.(md|html|txt|tpl)$/d; /_werc\/?$/d; s,^\./,,; '
+# ls -F style input of the form: $sitedir/path/to/files/
+# <ls -F+x><symlink hack><Useless?><hiden files >
+dirfilter='s/\*$//; s,/+\./+,/,g; s,^\./,,; /\/[._][^\/]/d; /'^$forbidden_uri_chars^'/d; /^\/(robots|sitemap)\.txt$|\/index\.(md|html|txt|tpl)$/d; /_werc\/?$/d; '
dirclean=' s/\.(md|html|txt)$//; '
# To be used from config files
@@ -33,7 +34,8 @@ fn hide_paths {
# Sidebar
fn gensidebar {
# Ignore stderr, last path element might be a file that doesn't exist (eg., foo for foo.md)
- ls -F $sitedir^/./^$req_paths_list >[2]/dev/null|sed 's!^'$sitedir'!!; '^$dirfilter^'/\/[^_.\/][^\/]*(\.(md|txt|html)|\/)$/!d; '^$dirclean|sort -u|awk -F/ '
+ # /./ to deal with p9p's ls failure to follow dir symlinks otherwise
+ ls -F $sitedir/./$req_paths_list >[2]/dev/null|sed 's!^'$sitedir'!!; '^$dirfilter^'/\/[^_.\/][^\/]*(\.(md|txt|html)|\/)$/!d; '^$dirclean|sort -u|tee /tmp/d|awk -F/ '
function p(x, y, s) {
for(i=0; i < x-y; i+=1)
print s