swerc

anselm's simpler werc fork
git clone git://git.suckless.org/swerc
Log | Files | Refs | README

commit 4e812bb92943db82802b9e5885f8d11cc9aed220
parent 807cccd1ddb20175edd7dc0fff89bde92e93f01d
Author: uriel@engel.se.cat-v.org <unknown>
Date:   Mon, 28 May 2007 04:07:40 +0200

A bunch of stuff before breaking things up
Diffstat:
Mbin/controller.rc | 52+++++++++++++++++++++++++++++++++++++++++++++++++---
Abin/sidebar.tpl | 1+
Metc/initrc | 3++-
Mpub/sitemap.txt | 11++++++++---
Mpub/style/style.css | 4++++
Dtpl/_inc/sidebar.tpl | 35-----------------------------------
Mtpl/default.tpl | 13++++---------
Mtpl/software/index.md | 1+
Mtpl/software/xml.md | 5++++-
9 files changed, 73 insertions(+), 52 deletions(-)

diff --git a/bin/controller.rc b/bin/controller.rc @@ -9,6 +9,8 @@ cd .. # config body=index +siteTitle='' +siteSubTitle='' title=Title template=default sidebar=sidebar @@ -17,6 +19,7 @@ sidebar=sidebar if (! ~ $#args 0 && ! ~ $args '') { title=$args($#args) + title=`{echo $title | sed 's/_/ /' } body=`{ echo -n $"args |sed 's, ,/,g' } } @@ -36,9 +39,52 @@ if (test -d tpl/$body) { body=`{echo tpl/^$"body^.md | sed 's, ,/,' } +# Sidebar +fn menu { + ls -F $1 | sed -e 's,^./,,' -e 's,\.md$,,' | grep -v '^_'| awk ' + BEGIN { print "<ul class=\"sidebar\">" } + END { print "</ul>" } + /^([a-zA-Z0-9_\-]+[\/*]?)+$/ && ! /index$/ { + isdir = match($0, "/$") + sub("[*/]$", "") # The '*' makes no sense to me + + if(isdir) + d = "/" + bname = $0 + sub("^(.*/)?([0-9]+_)?", "", bname) + gsub("_", " ", bname) + + bname = bname d + + if(index(ENVIRON["REQUEST_URI"], "/" $0) == 1) { + if(isdir) { + print "<li><a href=\"/" $0 d "\">&raquo;<i> " bname "</i></a>" + system("rc -c ''menu " $0 "''") + } else { + print "<li><a href=\"/" $0 d "\" class=\"thisPage\">&raquo;<i> " bname "</i></a>" + } + } else + print "<li><a href=\"/" $0 d "\">&rsaquo; " bname "</a>" + + print "</li>" + + }' + +} + +fn gensidebar { + echo '<p class="sideBarTitle">Considered harmful:</p>' + cd tpl + menu . + cd .. +} + + +# Body + template.awk $template | rc -echo '<pre>' -#echo $"args -#env +# Debug junk +#echo '<pre>' +#env diff --git a/bin/sidebar.tpl b/bin/sidebar.tpl @@ -0,0 +1 @@ + diff --git a/etc/initrc b/etc/initrc @@ -1,2 +1,3 @@ title=cat-v -sitetitle=harmful.cat-v.org +siteTitle='cat-v' +siteSubTitle='Considered harmful' diff --git a/pub/sitemap.txt b/pub/sitemap.txt @@ -1,10 +1,15 @@ http://harmful.cat-v.org/ +http://harmful.cat-v.org/society/sweden +http://harmful.cat-v.org/society/children/ +http://harmful.cat-v.org/society/children/fuck_the_children +http://harmful.cat-v.org/society/children/i_dont_care http://harmful.cat-v.org/cat-v/ +http://harmful.cat-v.org/software/firefox http://harmful.cat-v.org/software/ http://harmful.cat-v.org/software/xml -http://harmful.cat-v.org/children/ -http://harmful.cat-v.org/children/fuck_the_children -http://harmful.cat-v.org/children/i_dont_care +http://harmful.cat-v.org/software/object_oriented_programming +http://harmful.cat-v.org/science/global_warming +http://harmful.cat-v.org/economics/intellectual_property http://harmful.cat-v.org/economics/subsidies http://harmful.cat-v.org/economics/ http://harmful.cat-v.org/economics/minimum_wage diff --git a/pub/style/style.css b/pub/style/style.css @@ -83,6 +83,10 @@ acronym, .titleTip { font-style: italic; } +.headerTitle a { + color: black; + text-decoration: none; +} .subHeader { display: none; diff --git a/tpl/_inc/sidebar.tpl b/tpl/_inc/sidebar.tpl @@ -1,35 +0,0 @@ -echo '<p class="sideBarTitle">Considered harmful:</p>' -fn menu { - ls -F $1 | sed -e 's,^./,,' -e 's,\.md$,,' | grep -v '^_'| awk ' - BEGIN { print "<ul class=\"sidebar\">" } - END { print "</ul>" } - /^([a-zA-Z0-9_\-]+[\/*]?)+$/ && ! /index$/ { - isdir = match($0, "/$") - sub("[*/]$", "") # The '*' makes no sense to me - - if(isdir) - d = "/" - bname = $0 - sub("^(.*/)?([0-9]+_)?", "", bname) - gsub("_", " ", bname) - - bname = bname d - - if(index(ENVIRON["REQUEST_URI"], "/" $0) == 1) { - if(isdir) { - print "<li><a href=\"/" $0 d "\">&raquo;<i> " bname "</i></a>" - system("rc -c ''menu " $0 "''") - } else { - print "<li><a href=\"/" $0 d "\" class=\"thisPage\">&raquo;<i> " bname "</i></a>" - } - } else - print "<li><a href=\"/" $0 d "\">&rsaquo; " bname "</a>" - - print "</li>" - - }' - -} -cd tpl -menu . -cd .. diff --git a/tpl/default.tpl b/tpl/default.tpl @@ -8,11 +8,10 @@ Content-Type: text/html <meta name="verify-v1" content="6zEoK0WMlnLmIS/w7Pnh6+srZECHsvnMGN0kQmowSGk=" /> -% echo '<title>'$title'</title>' +% echo '<title>'$"title' - '$"siteTitle'</title>' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <meta name="copyright" content="&copy; 2007 by k" /> - <meta name="author" content="uriel" /> + <meta name="author" content="k" /> <link rel="stylesheet" href="/style/style.css" type="text/css" media="screen" title="default" /> <link rel="stylesheet alternative" type="text/css" href="/style/style_old.css" media="screen" title="Old Style" /> @@ -37,7 +36,7 @@ Content-Type: text/html </div> <div class="midHeader"> - <h1 class="headerTitle">cat-v <span id="headerSubTitle">Considered harmful</span></h1> +%echo '<h1 class="headerTitle"><a href="/">'$"siteTitle' <span id="headerSubTitle">'$"siteSubTitle'</span></a></h1>' </div> <div class="subHeader"> @@ -47,9 +46,8 @@ Content-Type: text/html %if (! ~ $#sidebar 0) { <div id="side-bar"> -% # template.awk $sidebar | rc <div> -% cat $sidebar | rc +% gensidebar </div> <div class="spam" style="padding: 1em 0;"> @@ -127,11 +125,8 @@ Content-Type: text/html <div id="footer"> <!-- -%#echo $body <br class="doNotDisplay doNotPrint" /> <div class="right"> -Author: <a href="http://cat-v.org/who/uriel/">uriel</a> -<br /> Hosted at: <a href="http://cat-v.org">cat-v.org</a> </div> --> diff --git a/tpl/software/index.md b/tpl/software/index.md @@ -15,3 +15,4 @@ dollars. But there is one quality that cannot be purchased in this way -and that is reliability. The price of reliability is the pursuit of the utmost simplicity. It is a price which the very rich find most hard to pay.*" -- C.A.R. Hoare +"*It's a curious thing about our industry: not only do we not learn from our mistakes, we also don't learn from our successes.*" -- Keith Braithwaite diff --git a/tpl/software/xml.md b/tpl/software/xml.md @@ -4,7 +4,7 @@ XML Sucks "*The essence of XML is this: the problem it solves is not hard, and it does not solve the problem well."* -- Phil Wadler, POPL 2003 -For now see [xmlsucks.org](http://www.xmlsucks.org). +For now see [xmlsucks](http://www.xmlsucks.com). Alternatives ------------ @@ -30,3 +30,6 @@ Alexander Viro on linux-kernel mailing list: They won't be thrown. They will be slowly driven under the nails, so that victim could experience the joy equal to that of dealing with XML. +"*Some part of me desperately wants to believe that XML-RPC is some kind of elaborate joke, like a cross between Discordianism and IP Over Avian Carriers.*" -- Ex-Cyber on #plan9 + +"*XML is simply lisp done wrong.*" -- Alan Cox