ref: f5cacb5d07bc6a6bfc3c0f863afb6c40925ab84e
parent: a365843a0268630372d1e26a01c9e8e1b1a7ba7c
author: uriel <uriel@suckless.org>
date: Fri Jun 6 05:39:07 EDT 2008
* s/formater/formatter/g * Fix rss validator warnings * Fix xhtml validator errors (properly close <link /> tag and remove align= attribute).
--- a/bin/controller.rc
+++ b/bin/controller.rc
@@ -8,8 +8,8 @@
cd ..
# default config
-formater=markdown.pl
-formater=md_cache # markdown cacher
+formatter=markdown.pl
+formatter=md_cache # markdown cacher
site=$SERVER_NAME
sitedir=sites/$site
headers=inc/headers.tpl
@@ -31,9 +31,11 @@
# Sidebar
fn menu {
lsArgs = ( '-F' )
- if (! ~ $#blogDirs 0) {
+ # XXX will not work properly for $#blogDirs > 1 and matching is hackish
+ if ( (!~ $#inBlog 0) || ! ~ $#blogDirs 0 && (~ $blogDirs^/ *$1 *$1/) ) { # Work in progress XXX
lsArgs = ($lsArgs -r)
}
+
ls $lsArgs $1 | sed $dirfilter | awk -F/ '
BEGIN { print "<ul class=\"sidebar\">" }
END { print "</ul>" }
@@ -88,8 +90,8 @@
fn genbody {
if ( test -f $body.md ) {
if ( ! ~ $#inBlog 0 )
- blogTitle $body.md | $formater
- $formater < $body.md
+ blogTitle $body.md | $formatter
+ $formatter < $body.md
}
if not if ( test -f $body.tpl )
template.awk $body.tpl | rc $rcargs
@@ -107,13 +109,15 @@
ls -F `{ basename -d $body } | sed -e $dirfilter' s,^'$sitedir'/.*/([^$].*),<li><a href="\1">\1</a></li>,'
echo '</ul>'
}
- if not if(~ $#blogDirs 0)
+ if not if(~ $#blogDirs 0) {
+ #echo 'Status: 404 Not Found\n\n' # should go before starting to print body
template.awk inc/404.tpl | rc $rcargs
+ }
if(! ~ $#blogDirs 0) {
if ( ! ~ $blogTitle '' )
echo '<h1>'$"blogTitle'</h1>'
- echo '<div align="right">(<a href="index.rss">rss feed</a>)</div>'
+ echo '<div style="text-align:right">(<a href="index.rss">rss feed</a>)</div>'
for ( f in `{ sortedBlogPostList $blogDirs } ) {
#title=`{basename $f | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' }
#du=`{ls -l $f}
@@ -121,7 +125,7 @@
blogTitle $f
cat $f
echo
- } | $formater
+ } | $formatter
}
}
@@ -136,7 +140,7 @@
}
fpath=$sitedir
-for ( i in '' $args ) {
+for ( i in ('' $args) ) {
fpath = $fpath/$i
# We don't want blog settings to cascade into posts, note that we are inBlog instead
if ( ! ~ $#blogDirs 0 && ! ~ $body */indexrss */[bB]log */[bB]log/ ) {
@@ -167,7 +171,7 @@
rssuri=`{basename -d $uri}
rssuri=$baseuri`{cleanname $"rssuri^/index.rss}
extraHeaders=$"extraHeaders ^ \
- '<link rel="alternate" type="application/rss+xml" title="RSS" href="'$rssuri'">
+ '<link rel="alternate" type="application/rss+xml" title="RSS" href="'$rssuri'" />
'
}
@@ -221,20 +225,21 @@
Content-Type: text/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
-<rss version="2.0">
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
+ <atom:link href="%('http://'$site^$REQUEST_URI%)" rel="self" type="application/rss+xml" />
<title>%($siteTitle%)</title>
<link>%($uri%)</link>
<description>%($blogDesc%)</description>
<language>en-us</language>
<generator>Tom Duff's rc, and Kris Maglione's clever hackery</generator>
- <webMaster>Uriel Mangado <uriel99@gmail.com></webMaster>
+ <webMaster>uriel99+rss@gmail.com (Uriel)</webMaster>
%{
for(f in `{sortedBlogPostList $blogDirs}) {
statpost $f
%} <item>
<title>%($title%)</title>
- <author>%($by%)@noreply.cat-v.org</author>
+ <author>%($by%)@noreply.cat-v.org (%($by%))</author>
<link>%($uri%)</link>
<guid isPermaLink="true">%($uri%)</guid>
<pubDate>%($date%)</pubDate>
@@ -244,4 +249,3 @@
</channel>
</rss>
!
-