We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
现在xtemplate已经局部的支持了mustache的语法。有没有打算对mustache的全部语法做支持。 先提供一些测试用例
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <title>brix tmpl test</title> <script src="http://a.tbcdn.cn/s/kissy/1.3.0/seed.js"></script> </head> <body> <div class="container"> </div> <script type="text/javascript"> var list = { a: true, b: function(){return 'b'}, c: [1,2,3], data: { name: 'h', age: 2 } } KISSY.ready(function(S){ S.use('xtemplate,node',function(S,XTemplate){ S.one('.container').html(new XTemplate(S.one('#tmpl').html()).render(list)); }); }) </script> <script type="text/tmpl" id="tmpl"> <div> <h1>不支持true,false的判断</h1> {{#a}}<div>true</div>{{/a}} <h1>不支持function</h1> <div>{{{b}}}</div> <h1>不支持Array</h1> {{#c}} <div>{{.}}</div> {{/c}} <h1>不支持属性向上查找判断</h1> {{#data}}{{name}}-{{b}}-{{age}}{{/data}} </div> </script> </body> </html>
The text was updated successfully, but these errors were encountered:
为了便于使用和移植,尽量兼容:
Sorry, something went wrong.
对Array的兼容还有点问题, {{#c}}
正确的应该是不输出。
@keyapril
和属性一样处理,默认 silent true 不会报错
{{#f}}
{{this}}
{{/f}}
=>
{}
空
如果
new XTemplate(str,{ silent:false })
则报命令找不到,因为这种写法是为了兼容 mustache,并不推荐,推荐 # 后面是跟命令名,如 #if #each #with ,这样更清楚点(强类型)
还有一个没有做兼容
{{^a}}
^这个符号在mustache中表示非
support {{.}} f48f12a
No branches or pull requests
现在xtemplate已经局部的支持了mustache的语法。有没有打算对mustache的全部语法做支持。
先提供一些测试用例
The text was updated successfully, but these errors were encountered: