テンプレート言語についてMustache


@Fenng A client-rendering framework for Facebook by Changhao Jianghttp://t.co/NIo6vCd
 
Fenngはテンプレート言語を推薦した:mustache(ひげを意味する).
 
mustacheの公式サイトでは、次のように紹介されています.
 
Logic-less templates.
Available in Ruby, JavaScript, Python,Erlang, PHP, Perl, Objective-C, Java, .NET,Android, C++, Go, Lua, ooc, ActionScript,ColdFusion, Scala, Clojure, Fantom,CoffeeScript, D, and for node.js.
Works great with TextMate, Vim, Emacs, andCoda.
The Manual: mustache(5) and mustache(1)
 
要するに、多くの言語を支持し、著者はフェイスブックの蒋博士である.
 
すべての使い方の詳細はhttp://mustache.github.com/mustache.5.html
githubのhtmlカラー卵:
 
個人的にはsmartyよりずっと使いやすいと思います.ほかではない.簡潔明瞭だからだ.
豆弁説(http://shuo.douban.com)というテンプレートを使っていますか?注目中
使い方を簡単に説明します.
 
1A typical Mustache template:
 
Hello {{name}}
You have just won ${{value}}!
{{#in_ca}}
Well, ${{taxed_value}}, after taxes.
{{/in_ca}} 

Given the following hash:
{
  "name": "Chris",
  "value": 10000,
  "taxed_value": 10000 - (10000 * 0.4),
  "in_ca": true
} 

Will produce the following:
Hello Chris
You have just won $10000!
Well, $6000.0, after taxes. 
Mustache      html                。    hash               。    if-else,for-loop  ,    (tag)。
       {{name}},{{#person}}       .      ,       。{{{html}}} {{& html}}          html  。
      {{#person}} ... {{/person}}   。  
Shown.
{{#nothin}}
  Never shown!
{{/nothin}} 
  Shown.(      nothin)
             ,                  。  

Template:

{{#repo}}
  <b>{{name}}</b>
{{/repo}} 
Hash:
{
  "repo": [
    { "name": "resque" },
    { "name": "hub" },
    { "name": "rip" },
  ]
} 
Output:
<b>resque</b>
<b>hub</b>
<b>rip</b> 
  ,Mustache  lambda   

Template:

{{#wrapped}}
  {{name}} is awesome.
{{/wrapped}} 
Hash:
{
  "name": "Willy",
  "wrapped": function() {
    return function(text) {
      return "<b>" + render(text) + "</b>"
    }
  }
} 
Output:
<b>Willy is awesome.</b> 
{{! ignore me }}
base.mustache:
<h2>Names</h2>
{{#names}}
  {{> user}}
{{/names}}

user.mustache:
<strong>{{name}}</strong> 
    
<h2>Names</h2>
{{#names}}
  <strong>{{name}}</strong>
{{/names}} 
     {{}}         !
          ,     。 python  ,    。