diff --git a/bin/werc.rc b/bin/werc.rc index f6dfcc7..9820a0d 100755 --- 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/ +# +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