#use wml::std::logo

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta name="author" content="Jan Krüger">
<link rel="stylesheet" type="text/css" href="main.css">
<title>{#PAGETITLE#} - Jan Krüger, Universiteit Maastricht</title>
<body>
<h1>{#PAGETITLE#}</h1>

{#BODY#}

<div class="footer">
<font size="-1">
	Copyright © <b>Jan Krüger</b>, 2003-2009.  <a
	href="http://jast.heapsort.de/">my other homepage</a> | <a
	href="http://jan-krueger.net/">my exciting blog</a>
</font>
<br>
	<a href="http://validator.w3.org/check/referer"
	><img border="0" src="http://www.w3.org/Icons/valid-html401"
		alt="Valid HTML 4.01." height="31" width="88"
	></a>

	<a href="http://jigsaw.w3.org/css-validator/check/referer"
	><img style="border:0;width:88px;height:31px"
		src="http://jigsaw.w3.org/css-validator/images/vcss"
		alt="Valid CSS."
	></a>

	<a href="http://www.anybrowser.org/campaign/"
		><img border="0" src="w3c_ab.png"
		alt="Optimized for any browser."
	></a>

	<img src="woffles.png" alt="Quux.">
</div>
</body>

#
# DEFINED TAGS
# as of jast ;)
#

# content replacement

<define-tag pagetitle>\
	{#PAGETITLE#:%0:##}\
</define-tag>

<define-tag description>\ 
	{#PAGEDESC#:%0:##}\
</define-tag>

<define-tag downloads>\
	{#DOWNLOADS#:%0:##}\
</define-tag>

# get info from another WML file

<define-tag get-firstocc>\
<preserve tag href>\
<set-var %attributes>\
<:{
	my $href = qq/<get-var href>/,
		$tag = qq/<get-var tag>/;

	if (!-f "$href.wml") {
		die "get-pagetitle: '$href' can't be found: $!";
	}
	open(FILE,"$href.wml") || die "get-pagetitle: ERROR reading '$href' - $!";
	my $lt = "<";
	my $a = join "", <FILE>;
	close FILE;
	$a =~ /${lt}$tag "(.+?)">/s;
	print $1;
}:>\
<restore tag href>\
</define-tag>

<define-tag get-pagetitle>\
<get-firstocc tag=pagetitle %attributes>\
</define-tag>

<define-tag get-pagedesc>\
<get-firstocc tag=description %attributes>\
</define-tag>

<define-tag get-downloads>\
<get-firstocc tag=downloads %attributes>\
</define-tag>

# structural constructs

<define-tag para endtag="required" whitespace="delete">
<set-var order="<if %2 %2 2>">
<when "%1"><when "%0">;;; ugly construction ^_____^
<a name="%1"></a><h<get-var order>>%0</h<get-var order>>
{#PAGENAV#: | <a href="#%1">%0</a>:##}\
</when></when>\
	<p>%body</p>
</define-tag>

# link another WML page

<define-tag linkpage whitespace="delete">\
<preserve href desc>\
<set-var %attributes><a href="<get-var href>.html">\
<if "<get-var desc>" "<get-var desc>" "<get-pagetitle href=<get-var href>>">\
</a>\
<restore href desc>\
</define-tag>

# create a navigation chain

<define-tag navchain>\
<set-var chain="<subst-in-string "%attributes" " " "\n">">\
<div class="navchain"><b>You are here</b>: \
<foreach item chain>\
<linkpage href="<get-var item>"> »
</foreach>
{#PAGETITLE#}<font size="-1">{#PAGENAV#}</font>
</div>\
</define-tag>

# insert a table of pages
# man I hate this mp4h crap. ;/

<define-tag list-pages whitespace="delete">\
<set-var chain="%attributes">\
<table class="filelist" border="0" cellpadding="0" cellspacing="0">
<tr><th>Item</th><th>D/L</th><th>Description</th></tr>
<foreach item chain>\
<subst-in-var item "^\s+" "">
<when "<string-eq <substring <get-var item> 0 3> ":L ">">\
;;; so it's a hyperlink
<set-var linkitem="<get-var item>">\
<subst-in-var linkitem "^:L " "">\
<subst-in-var linkitem "\|" "\n">\
<tr>
	<td class="leftmost"><a href="<get-var linkitem[1]>"><get-var linkitem[0]></a></td>
	<td class="dunno">?</td>
	<td><get-var linkitem[2]></td>
</tr></when>\
<when "<string-eq <substring <get-var item> 0 3> ":C ">">\
;;; looks like a category delimiter
<tr><td colspan="3" class="delim"><substring "<get-var item>" 3></td></tr>
</when>;;; otherwise, it's a page we need to list
<when "<string-neq <substring <get-var item> 0 1> ":">">\
<set-var dnls="<get-downloads href=<get-var item>>">
<tr>
	<td class="leftmost"><linkpage href="<get-var item>"></td>
	<td class="<get-var dnls>"><get-var dnls></td>
	<td><get-pagedesc href="<get-var item>"></td>
</tr>
</when></foreach>\
</table>\
</define-tag>

{#BODY#:

# vim:ft=wml
