3 category: JavaScript libraries
13 Handlebars.registerHelper('link_to', function() {
14 return "<a href='" + this.url + "'>" + this.body + "</a>";
19 var context = { posts: [{url: "/hello-world", body: "Hello World!"}] }
20 var source = "<ul>{{#posts}}<li>{{{link_to}}}</li>{{/posts}}</ul>"
24 var template = Handlebars.compile(source)
32 <li><a href='/hello-world'>Hello World!</a></li>