* s/formater/formatter/g

* Fix rss validator warnings
* Fix xhtml validator errors (properly close <link /> tag and remove align= attribute).
This commit is contained in:
uriel 2008-06-06 09:39:07 +02:00
parent 40e5ad565b
commit a9036d180d

View File

@ -8,8 +8,8 @@ ifs='/' {
cd .. cd ..
# default config # default config
formater=markdown.pl formatter=markdown.pl
formater=md_cache # markdown cacher formatter=md_cache # markdown cacher
site=$SERVER_NAME site=$SERVER_NAME
sitedir=sites/$site sitedir=sites/$site
headers=inc/headers.tpl headers=inc/headers.tpl
@ -31,9 +31,11 @@ dirfilter = '/\/[._]/d; s,^\./,,; s,\.md$,,; s,\.html,,;'
# Sidebar # Sidebar
fn menu { fn menu {
lsArgs = ( '-F' ) 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) lsArgs = ($lsArgs -r)
} }
ls $lsArgs $1 | sed $dirfilter | awk -F/ ' ls $lsArgs $1 | sed $dirfilter | awk -F/ '
BEGIN { print "<ul class=\"sidebar\">" } BEGIN { print "<ul class=\"sidebar\">" }
END { print "</ul>" } END { print "</ul>" }
@ -88,8 +90,8 @@ fn blogTitle {
fn genbody { fn genbody {
if ( test -f $body.md ) { if ( test -f $body.md ) {
if ( ! ~ $#inBlog 0 ) if ( ! ~ $#inBlog 0 )
blogTitle $body.md | $formater blogTitle $body.md | $formatter
$formater < $body.md $formatter < $body.md
} }
if not if ( test -f $body.tpl ) if not if ( test -f $body.tpl )
template.awk $body.tpl | rc $rcargs template.awk $body.tpl | rc $rcargs
@ -107,13 +109,15 @@ fn genbody {
ls -F `{ basename -d $body } | sed -e $dirfilter' s,^'$sitedir'/.*/([^$].*),<li><a href="\1">\1</a></li>,' ls -F `{ basename -d $body } | sed -e $dirfilter' s,^'$sitedir'/.*/([^$].*),<li><a href="\1">\1</a></li>,'
echo '</ul>' 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 template.awk inc/404.tpl | rc $rcargs
}
if(! ~ $#blogDirs 0) { if(! ~ $#blogDirs 0) {
if ( ! ~ $blogTitle '' ) if ( ! ~ $blogTitle '' )
echo '<h1>'$"blogTitle'</h1>' 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 } ) { for ( f in `{ sortedBlogPostList $blogDirs } ) {
#title=`{basename $f | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' } #title=`{basename $f | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' }
#du=`{ls -l $f} #du=`{ls -l $f}
@ -121,7 +125,7 @@ fn genbody {
blogTitle $f blogTitle $f
cat $f cat $f
echo echo
} | $formater } | $formatter
} }
} }
@ -136,7 +140,7 @@ if (! ~ $args '') {
} }
fpath=$sitedir fpath=$sitedir
for ( i in '' $args ) { for ( i in ('' $args) ) {
fpath = $fpath/$i fpath = $fpath/$i
# We don't want blog settings to cascade into posts, note that we are inBlog instead # 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/ ) { if ( ! ~ $#blogDirs 0 && ! ~ $body */indexrss */[bB]log */[bB]log/ ) {
@ -167,7 +171,7 @@ if(! ~ $#blogDirs 0) {
rssuri=`{basename -d $uri} rssuri=`{basename -d $uri}
rssuri=$baseuri`{cleanname $"rssuri^/index.rss} rssuri=$baseuri`{cleanname $"rssuri^/index.rss}
extraHeaders=$"extraHeaders ^ \ 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 @@ cat <<'!' | template
Content-Type: text/xml; charset=utf-8 Content-Type: text/xml; charset=utf-8
<?xml version="1.0" encoding="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> <channel>
<atom:link href="%('http://'$site^$REQUEST_URI%)" rel="self" type="application/rss+xml" />
<title>%($siteTitle%)</title> <title>%($siteTitle%)</title>
<link>%($uri%)</link> <link>%($uri%)</link>
<description>%($blogDesc%)</description> <description>%($blogDesc%)</description>
<language>en-us</language> <language>en-us</language>
<generator>Tom Duff's rc, and Kris Maglione's clever hackery</generator> <generator>Tom Duff's rc, and Kris Maglione's clever hackery</generator>
<webMaster>Uriel Mangado &lt;uriel99@gmail.com&gt;</webMaster> <webMaster>uriel99+rss@gmail.com (Uriel)</webMaster>
%{ %{
for(f in `{sortedBlogPostList $blogDirs}) { for(f in `{sortedBlogPostList $blogDirs}) {
statpost $f statpost $f
%} <item> %} <item>
<title>%($title%)</title> <title>%($title%)</title>
<author>%($by%)@noreply.cat-v.org</author> <author>%($by%)@noreply.cat-v.org (%($by%))</author>
<link>%($uri%)</link> <link>%($uri%)</link>
<guid isPermaLink="true">%($uri%)</guid> <guid isPermaLink="true">%($uri%)</guid>
<pubDate>%($date%)</pubDate> <pubDate>%($date%)</pubDate>
@ -244,4 +249,3 @@ Content-Type: text/xml; charset=utf-8
</channel> </channel>
</rss> </rss>
! !