Skip to content
New issue

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

建议forstart规则中增加对数组运算符的过滤,否则有些嵌套的循环无法使用 #14

Closed
ciroyong opened this issue Sep 25, 2012 · 4 comments

Comments

@ciroyong
Copy link

//临时修改了一下,

var forstart = juicer.tags.operationOpen + 'each\s_([\w.[]]?)\s_as\s(\w_?)\s_(,\s_\w_?)?' + juicer.tags.operationClose;

//这样就可以使用如下的循环方式了

{@each a as name, i}
{@each b[name] as item, index}
${item.foo}
{@/each}
{@/each}

否则会提示错误:

“Missing catch or finally after try”

@PaulGuo
Copy link
Owner

PaulGuo commented Sep 25, 2012

Thx!!, 我会尽快提交新版本,下个版本中修复~ :)

@PaulGuo
Copy link
Owner

PaulGuo commented Oct 14, 2012

@ciroyong 测试了你提供的代码,没有报错,正常返回啊,
什么Juicer版本?什么浏览器,能否贴全DEMO代码和测试数据?

var tpl = '{@each a as name, i}' +
    '{@each b[name] as item, index}' +
        '${item}' +
    '{@/each}' +
'{@/each}';
juicer(tpl, {a: ['x', 'y', 'z', 'u'], b: {x: [1,2,3], y: [4,5,6], z: [5,6,7], u: [1,1,1]}});
// 正常返回 123456567111

@PaulGuo
Copy link
Owner

PaulGuo commented Oct 14, 2012

@ciroyong 请用目前最新的 0.6.1-stable 看下您的问题是否还存在,有问题请继续反馈给我,谢谢。

@PaulGuo PaulGuo closed this as completed Oct 14, 2012
@ciroyong
Copy link
Author

非常感谢! 最近没有忙这个项目,版本还是0.5.0,我近期升级一下吧!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants