Very minor dirfilter cleanups and some extra comments.

This commit is contained in:
Uriel 2009-01-04 07:57:13 +01:00
parent bfd31c5b37
commit 13c8137c76

View file

@ -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