A bunch of stuff before breaking things up

This commit is contained in:
uriel 2007-05-28 04:07:40 +02:00
parent 396ba6b980
commit e48d20254f
9 changed files with 73 additions and 52 deletions

View File

@ -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

1
bin/sidebar.tpl Normal file
View File

@ -0,0 +1 @@

View File

@ -1,2 +1,3 @@
title=cat-v
sitetitle=harmful.cat-v.org
siteTitle='cat-v'
siteSubTitle='Considered harmful'

View File

@ -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

View File

@ -83,6 +83,10 @@ acronym, .titleTip {
font-style: italic;
}
.headerTitle a {
color: black;
text-decoration: none;
}
.subHeader {
display: none;

View File

@ -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 ..

View File

@ -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>
-->

View File

@ -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

View File

@ -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