jquery.templateの使い方

jquery.pluginなので個別にいれる必要がある。
どんな表示になるかは何に貼ればよいのか分からなかったのでとりあえずjsdo.itに

<html>
  <head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<script src="http://code.jquery.com/jquery-latest.min.js"></script>
	<script src="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
  </head>
  <body>

	<script id="MyTemplate" type="text/x-jquery-tmpl"> 
	  <ul>${name}
		{{each items}}
		<li>${$index}:${$value}</li>
		{{/each}}
	  </ul>
	</script>
  </body>

  <h1>何か</h1>
  <div id="whitespace"></div>
  <script>
	var languages = [
	{ name: "ruby",
      items: ["赤い", "日本?", "宝石"],
	},
	{ name: "python",
	  items: ["蛇", "翻訳", "hebi"],
	},
	{ name: "lua",
	  items: ["月", "ブラジル","組み込み?"],
	}
	];
	$("#MyTemplate").tmpl(languages).appendTo("#whitespace");
  </script>
</html>
  1. text/x-jquery-tmpl というmimetypeで保存する。
  2. $(template).tmpl(json).appendTo(element) というような感じ.
  3. loopも掛ける。
misc

Ctrl + Shift + kで開けるwebconsole的なものが便利。