赞
踩
Logic-less templates.
github:http://mustache.github.com/
文档:http://mustache.github.com/mustache.5.html
Java 版 Mustache SVN 源码
http://jmustache.googlecode.com/svn
mustache 类似 freemark和valicity 模板引擎,不过mustache 更轻量级,支持语言: Ruby, JavaScript, Python,Erlang, node.js, PHP, Perl, Perl6, Objective-C, Java, C#/.NET, Android, C++, Go, Lua,ooc, ActionScript, ColdFusion, Scala, Clojure,Fantom, CoffeeScript, D, Haskell, XQuery,ASP, Io, Dart, Haxe, Delphi, Racket, Rust,OCaml, Swift, and for Bash
mustache 支持功能比较弱,不过我们可以建立在mustache 之上进行扩展实现。
mustache的特点就是很语法很简单,主要语法如下
Template:
- {{#person?}}
- Hi {{name}}!
- {{/person?}}
Hash:
- {
- "person?": { "name": "Jon" }
- }
Output:
Hi Jon!
Template:
- {{#repo}}
- <b>{{name}}</b> JS-USE:{{#first}}++{{/first}} JAVA-USE: first:{{-first}} last:{{-last}} index:{{-index}}
- {{/repo}}
- {{^repo}}
- No repos :(
- {{/repo}}
Hash:
- {
- "repo": []
- }
Output:
No repos :(
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。