shithub: werc

Download patch

ref: e45824d3da7d610051dbf6203eb12b0cf1507ecb
parent: 04da70c705020e3e842588f53fb2aa59be9e5a00
author: uriel <[email protected]>
date: Sat Dec 13 11:58:08 EST 2008

Fix sortedBlogPostList to handle paths containing a '.', and strip the '/./' used as a sort delimiter from output

--- a/bin/werc.rc
+++ b/bin/werc.rc
@@ -76,9 +76,10 @@
 }
 
 fn sortedBlogPostList {
-    # the /./ is added so we can sort -t. and order only the file name
+    # the /./->/|/ are added so we can sort -t| and order only the file name
+    # NOTE: this breaks if any path element in blogDirs contain '/./' or '|'
     if (! ~ $#* 0)
-        ls $*^'/./' | grep '/[0-9]+.*\.md$'| sort -r -t. +1
+        ls $*^'/./' | sed -n 's,/\./,/|/,; /\/[0-9]+.*\.md$/p' | sort -r '-t|' +1 | sed 's,/\|/,,'
 }
 
 fn gen_blog_post_title {