shithub: werc

Download patch

ref: 739a87e1784ac804326401b429063b07143fb21c
parent: 9f45db11e1c4856f9f3902ef56203d4292b9b052
author: sl <uriel@engel.se.cat-v.org>
date: Thu Dec 11 16:38:31 EST 2008

Fix and simplify code that generates rss/atom urls. Now it handles urls in / properly.

--- a/bin/werc.rc
+++ b/bin/werc.rc
@@ -205,12 +205,10 @@
         if (~ $#blogDirs 0)
             blogDirs = `{basename -d $body}
 
-        u=`{cleanname `{basename -d $uri}}
-        rssuri=$baseuri^$"u^/index.rss
-        atomuri=$baseuri^$"u^/index.atom
+        u=`{cleanname $baseuri^`{basename -d '/'^$uri}|sed 's,:/,://,'} # Sed recovers '/' in 'http:/' stripped by cleanname
         extraHeaders=$"extraHeaders ^ \
-    	'<link rel="alternate" type="application/rss+xml" title="RSS" href="'$rssuri'" />
-        <link rel="alternate" type="application/atom+xml" title="ATOM" href="'$atomuri'"/>
+    	'<link rel="alternate" type="application/rss+xml" title="RSS" href="'$"u'/index.rss" />
+<link rel="alternate" type="application/atom+xml" title="ATOM" href="'$"u'/index.atom" />
 
 '
         set_handler tpl_handler lib/feeds/html.tpl