shithub: werc

Download patch

ref: e243c0bc01650e2fa40124b3054883c1193cb365
parent: 0ba88d1b293ced49990c7a4a021f71e0cef80c3c
author: uriel <uriel@engel.se.cat-v.org>
date: Mon Jan 12 22:20:30 EST 2009

Update atom and rss templates to work with new blagh format.

--- a/lib/_apps/blagh/atom.tpl
+++ b/lib/_apps/blagh/atom.tpl
@@ -4,13 +4,12 @@
 
 <!-- TODO: See for more info:http://www.tbray.org/ongoing/When/200x/2005/07/27/Atomic-RSS  -->
 %{
-dprint XXX
 fn statpost {
     f = $1
 
     updated = `{/bin/date --rfc-3339'=seconds' -r $f |tr ' ' 'T'} 
     post_uri=$base_url^`{cleanname `{echo $f | sed -e 's!^'$sitedir'!!' -e 's/\.(md|tpl)$//g'}}
-    title=`{read $f}
+    title=`{read $f/index.md}
     # Not used: date=`{/bin/date -Rd `{basename $f |sed 's/(^[0-9\-]*).*/\1/; s/-[0-9]$//'}}
     # TODO: use mtime(1) and ls(1) instead of lunix's stat(1)
     stat=`{stat -c '%Y %U' $f}
--- a/lib/_apps/blagh/rss20.tpl
+++ b/lib/_apps/blagh/rss20.tpl
@@ -5,9 +5,10 @@
 %{
 fn statpost {
 	f = $1
+
 	post_uri = `{echo $f | sed 's,^'$sitedir',,'}
 	title=`{basename $f | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' }
-	date=`{/bin/date -Rd `{basename $f |sed 's/(^[0-9\-]*).*/\1/; s/-[0-9]$//'}}
+	date=`{/bin/date -Rd `{echo $f|sed 's,.*/([0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9])/.*,\1,'}}
 	# TODO: use mtime(1) and ls(1) instead of lunix's stat(1)
 	stat=`{stat -c '%Y %U' $f}
 	#mdate=`{/bin/date -Rd $stat(1)} # Not used because it is unreliable
@@ -21,7 +22,7 @@
 				exit
 			}
 			print
-		}' $f |fmt -j| sed 's/\]\]>/Fucking goddamn XML garbage/g'}
+		}' $f/index.md |fmt -j| sed 's/\]\]>/Fucking goddamn XML garbage/g'}
 	}
 }
 
@@ -37,7 +38,7 @@
 		<generator>Tom Duff's rc, and Kris Maglione's clever hackery</generator>
 %{
 		# <webMaster>uriel99+rss@gmail.com (Uriel)</webMaster>
-		for(f in `{sortedBlogPostList $blogDirs}) {
+        for(f in `{get_post_list $blagh_root$blaghDirs}) {
 			statpost $f
 			# Hack to aproximate the last build date 
 			#(use the mdate from last posted item)