shithub: werc

Download patch

ref: 7949ec58bca0e5a8d841e2661ddff13b210d65b6
parent: 3e1b92dff1c26ab1f6a7c1040529625c1d1af355
author: uriel <uriel@vm41.cat-v.org>
date: Sun Jul 19 04:01:42 EDT 2009

Properly handle dashes in paths the same way we treated underscores when generating page titles. This includes sitemaps, sidebar nav trees and the page title header itself.

--- a/bin/corehandlers.rc
+++ b/bin/corehandlers.rc
@@ -24,7 +24,7 @@
 
         bname = $NF d
         path = $0 d
-        gsub("_", " ", bname)
+        gsub(/[\-_]/, " ", bname)
 
         if(index(ENVIRON["req_path"] "/", path) == 1)
             print "<li><a href=\"" path "\" class=\"thisPage\">&raquo;<i> " bname "</i></a></li>"
--- a/bin/werc.rc
+++ b/bin/werc.rc
@@ -70,7 +70,7 @@
         perm_redirect $req_path^'/'
 
     if(! ~ $#args 0)
-        pageTitle=`{ echo $args|sed -e 's/([a-z])-([a-z])/\1 \2/g' -e 's/ / - /g' -e 's/_/ /g' }
+        ifs=$NEW_LINE { pageTitle=`{ echo $args|sed -e 's/ / - /g' -e 's/([a-z])-([a-z])/\1 \2/g' -e 's/_/ /g' } }
 
     cd $sitedir
     req_paths_list='/' # Note: req_paths_list doesn't include 'stnythetic' dirs.
--- a/tpl/sitemap.tpl
+++ b/tpl/sitemap.tpl
@@ -47,7 +47,7 @@
             u=`{echo $i|sed 's!'$sitedir'!!; '$dirclean's!/index$!/!; '}
             if(! ~ $#desc 0 && ! ~ $desc '')
                 desc=' - '$"desc
-            n=`{echo /$u|sed 's/_/ /g; s,.*/([^/]+)/?$,\1,'}
+            n=`{echo /$u|sed 's/[\-_]/ /g; s,.*/([^/]+)/?$,\1,'}
             echo '<li><a href="'$base_url$u'">'^$"n^'</a>' $"desc '</li>' 
             echo $base_url^$u >> $tmpfile
             if(test -d $i)