<html xmlns:py="http://genshi.edgewall.org/" py:strip="">
	<py:match path="head" once="true">
		<head>
			<title py:with="title = list(select('title/text()'))">Powerline<py:if test="title">: $title</py:if></title>
			<link rel="stylesheet" type="text/css" href="/data/humanmsg.css" />
			<style type="text/css" title="Default">
				@import url('/data/layout.css');
				@import url('/data/color.css');
			</style>
			<style type="text/css" title="Default (no colors)">
				@import url('/data/layout.css');
			</style>
			<script type="text/javascript" src="/data/jquery.js"></script>
			<script type="text/javascript" src="/data/humanmsg.js"></script>
			${select('*[local-name()!="title"]')}
		</head>
	</py:match>
	<py:match path="body" once="true">
		<body py:attrs="select('@*')">
			<div id="header">
				${select('navheader')}
			</div>
			<div id="content">
				<message py:if="error"><strong>Error:</strong> $error</message>
				${select('*[local-name()!="navheader"]|text()')}
			</div>
		</body>
	</py:match>
	<py:match path="navheader">
		<h1 py:with="path = str(select('text()')).lstrip('/').split('/')">
			<a href="/">Powerline</a>
			<py:for each="i, element in enumerate(path)"> /
				<py:choose test="">
					<py:when test="i == len(path) - 1 or (i == len(path) - 2 and path[-1] == '')"><span id="current-page">$element</span></py:when>
					<py:otherwise><a href="/${'/'.join(path[:i + 1])}">$element</a></py:otherwise>
				</py:choose>
			</py:for>
		</h1>
	</py:match>
	<py:match path="message" once="true">
		<script type="text/javascript" py:with="attrs = list(select('@*'))">
			jQuery(document).ready(function() {
				options = ${repr(dict((str(attr[0]), str(attr[1])) for attr in attrs[0])) if attrs else '{}'}
				humanMsg.displayMsg("${Markup(str(select('*|text()')).replace('\n', ''))}", options);
				return false;
			})
		</script>
		<noscript><div><p>${select('*|text()')}</p></div></noscript>
	</py:match>
</html>
