浏览代码

switched to @janl's way of handling partials to pass more tests

parser-rewrite
nathan@stravinsky.local 16 年前
父节点
当前提交
54c62e8a58
共有 1 个文件被更改,包括 6 次插入4 次删除
  1. +6
    -4
      mustache.js

+ 6
- 4
mustache.js 查看文件

@@ -159,16 +159,18 @@ var Mustache = function() {
if (!subTemplate) {
throw new Error("Unknown partial '" + item.tag + "'");
}
this.render(subTemplate, context, partials);
// TODO: below matches @janl's mustache, but not mustache(5)
/*
// this is the mustache(5) way
// this.render(subTemplate, context, partials);
// this is @janl's way
var subContext = context[item.tag];
if (typeof(subContext) == "object") {
this.render(subTemplate, subContext, partials);
} else {
this.send(subTemplate);
}
*/
} else if (item.operator && !item.noEscape) {
// ignore other operators
} else if (item.tag) {


正在加载...
取消
保存