Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

xtemplate: change syntax #570

Closed
yiminghe opened this Issue Feb 25, 2014 · 2 comments

Comments

Projects
None yet
2 participants
Member

yiminghe commented Feb 25, 2014

  • [!] 去除二义性,不兼容 mustache,if each 等必须显示指定。提高性能。 http://jsperf.com/jade-xtpl

  • [!] 改变语法,命令调用必须加括号,参数以逗号分隔,空格无意义。例如 {{#if(x > 1)}}{{/if}} {{each(data,"x")}}{{/each}}

  • [!] 不支持 {{^ ,用 ! 替代. 例如 {{^if x}} => {{if(!x)}}

  • [+] 支持命令的嵌套调用 {{join( map(users) )}},例如

    XTemplate.addCommand('range', function(scope,options){
        var ret=[];
        for(var i=options.params[0];i<options.params[1];i++){
           ret.push(i);
        }
        return ret;
    });
    
    {{#each (range(1,7))}}
    {{this}}
    {{/each}}

@yiminghe yiminghe closed this in cbf6298 Feb 25, 2014

这个改动是放在KISSY哪个版本里面了?

Member

yiminghe commented Mar 3, 2014

1.5

@yiminghe yiminghe added this to the 5.0.0 milestone Apr 24, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment