This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Tomasz Mazur (author)
Thu Jul 09 06:57:03 -0700 2009
nano /
| name | age | message | |
|---|---|---|---|
| |
jquery.nano.js | ||
| |
readme.md | Thu Jul 09 06:57:03 -0700 2009 |
readme.md
NANO - jQuery Template Engine
Basic Usage
Assuming you have following JSON response:
data= {
user: {
login: "tomek",
first_name: "Thomas",
last_name: "Mazur",
account: {
status: "active",
expires_at: "2009-12-31"
}
}
}
you can make:
$.nano("<p>Hello {user.first_name} {user.last_name}! Your account is <strong>{user.account.status}</strong></p>", data)
and you get ready string:
<p>Hello Thomas! Your account is <strong>active</strong></p>
Simple huh?
More Advanced Example
Displaying list of twitter search results (JSONP API)
html
<ul id="tweets"></ul>
javascript
var template = "<li><strong>@{from_user}</strong> {original_text}</li>"
var query = "beer OR vodka"
var container = $("ul#tweets")
$.getJSON("http://search.twitter.com/search.json?callback=?", {
q: query
}, function(data) {
container.html("")
$.each(data.results), function(i, item){
container.append($.nano(template, item))
}
}
}








