ref: 7a48d5e01c06197f15bd65b2eb23be2d9bd02872
parent: f5cacb5d07bc6a6bfc3c0f863afb6c40925ab84e
author: uriel <uriel@suckless.org>
date: Mon Jun 9 03:21:39 EDT 2008
- Move some of the rss code to where it belongs - Generate </body></html> automatically
--- a/bin/controller.rc
+++ b/bin/controller.rc
@@ -175,27 +175,8 @@
'
}
-# RSS
-fn statpost {
- f = $1
- uri = `{echo $f | sed 's,^'$sitedir',,'}
- title=`{basename $f | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' }
- stat=`{stat -c '%Y %U' $f}
- date=`{/bin/date -Rd @$stat(1)}
- uri=$baseuri^`{cleanname `{echo -n $uri | sed 's/\.(md|tpl)//g'}}
- by=$stat(2)
- ifs=() {
- summary=`{awk -v max'='1024 '{
- nc += 1 + length;
- if(nc > max) {
- print substr($0, 1, nc - max) "..."
- exit
- }
- }' $f | sed 's/\]\]>/Fucking goddamn XML garbage/g'}
- }
-}
+
fn template {
template.awk | rc $rcargs |
awk '{
@@ -210,9 +191,11 @@
if(! ~ $REQUEST_URI */index.rss) {
cat $headers $template | template
+ echo '</body></html>'
exit
}
+# RSS
if ( ~ $body */[bB]log/indexrss */[bB]log//indexrss && ~ $#blogDirs 0 )
blogDirs = `{basename -d $body}
@@ -219,6 +202,26 @@
uri = `{echo $uri | sed 's/indexrss$//'}
uri=$baseuri$"uri
+
+fn statpost {
+ f = $1
+ uri = `{echo $f | sed 's,^'$sitedir',,'}
+ title=`{basename $f | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' }
+ stat=`{stat -c '%Y %U' $f}
+ date=`{/bin/date -Rd @$stat(1)}
+ uri=$baseuri^`{cleanname `{echo -n $uri | sed 's/\.(md|tpl)//g'}}
+ by=$stat(2)
+ ifs=() {
+ summary=`{awk -v max'='1024 '{
+ nc += 1 + length;
+ if(nc > max) {
+ print substr($0, 1, nc - max) "..."
+ exit
+ }
+ }' $f | sed 's/\]\]>/Fucking goddamn XML garbage/g'}
+ }
+}
# Should be in a separate file.
cat <<'!' | template