Skip to content

Instantly share code, notes, and snippets.

@pure
Created March 13, 2011 12:58
Show Gist options
  • Save pure/868069 to your computer and use it in GitHub Desktop.
Save pure/868069 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://github.com/pure/pure/raw/master/libs/pure.js"></script>
</head>
<body>
<div id="template">
<p></p>
<ul>
<li>
<span class="name"></span> - <span class="price"></span>
</li>
</ul>
</div>
<script>
var data = {
hotel:{
name:'Good Night',
roomCategories:[
{
name:'Standard',
price:150
},{
name:'Deluxe',
price:200
}]
}
},
dir = {
p:'hotel.name',
li:{
'category<-hotel.roomCategories':{
'span.name':'category.name',
'span.price':'category.price'
}
}
};
$('#template').render(data, dir);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment