var pagedata = {
	title : "JSTAL test",
	features : [
		{name:"define", status:"buggy"},
		{name:"condition", status:"implemented"},
		{name:"repeat", status:"partially implemented"},
		{name:"content", status:"implemented"},
		{name:"replace", status:"implemented"},
		{name:"attributes", status:"implemented"},
		{name:"omit-tag", status:"implemented"}
	],
	weekdays : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
	today : (function(){ 
		var d = new Date();
		return d.getFullYear() + '/' + (d.getMonth()+1) + '/' + d.getDate();
	})(),
	truecondition : 1,
	linkAttributes : {
		classname : "important",
		style: "border:1px solid #f00; background:#dff;  display: block; padding:20px",
		href:"http://code.google.com/p/jstal/"
	}
}

var template = new XML(
	<html xmlns:tal="http://xml.zope.org/namespaces/tal">
	<head>
		<title tal:content="pagedata/title">Untitled document</title>
	</head>
	<body>
		<h1 tal:content="pagedata/title">Untitled document</h1>
		<span tal:define="author string:Pawel Knapik" tal:omit-tag="true" />		
		<p tal:content="author">author</p>
		<table>
			<thead>
				<tr>
					<th>feature</th>
					<th>status</th>
				</tr>
			</thead>
			<tbody>
				<tr tal:repeat="feature pagedata/features">
					<td tal:content="feature/name">feature name</td>
					<td tal:content="feature/status">implemented or not</td>
				</tr>
			</tbody>
		</table>
		<p>
			Today is <span tal:replace="pagedata/weekdays[new Date().getDay()]" />, 
			you may use JS inside the template to display the date 
			<span tal:replace="js:new Date().getFullYear()"/> / <span tal:replace="js:new Date().getMonth()+1"/> / <span tal:replace="js:new Date().getDate()"/>
			<br />
			or predefine the result <span tal:replace="pagedata/today" />
		</p>
		<div tal:condition="pagedata/falsecondition">This should not be rendered</div>
		<div tal:condition="pagedata/truecondition">This should be rendered</div>
		<p tal:attributes="style string:color:red">this should be red</p>
		<a tal:attributes="href pagedata/linkAttributes/href; class pagedata/linkAttributes/classname; style pagedata/linkAttributes/style">more</a>
	</body>
	</html>);

