shithub: werc

Download patch

ref: dcf463405ddbd40ffeab8c9dd0041ac8f7725f95
parent: 95392066daad5df1427e855cc4b3f4ce5317fe5f
author: Uriel <u@berlinblue.org>
date: Mon Jun 27 23:48:22 EDT 2011

When more than one file with the same 'name' (eg., foo.md, foo.html) do not display it more than once in dir listings.

--- a/bin/corehandlers.rc
+++ b/bin/corehandlers.rc
@@ -77,7 +77,7 @@
         d='/'
     echo $d|sed 's,.*//,,g; s,/$,,; s,/, / ,g; 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 $dir_listing_ls_opts $sitedir$d/. | sed $dirfilter$dirclean | awk '{match($0, "/[^/]*/?$"); l=substr($0, RSTART+1, RLENGTH-1);n=l; gsub(/[\-_]/, " ", n); print "<li><a href=\""l"\">"n"</a></li>"; }'
+    ls -F $dir_listing_ls_opts $sitedir$d/. | sed $dirfilter$dirclean | awk '{match($0, "/[^/]*/?$"); l=substr($0, RSTART+1, RLENGTH-1);n=l; gsub(/[\-_]/, " ", n); print "<li><a href=\""l"\">"n"</a></li>"; }' | uniq
     echo '</ul>'
 }