Got Qunit tests running through RSpec and fixed a bunch of bugs... 33 fails from the original suite to go
This commit is contained in:
@@ -20,4 +20,13 @@ Handlebars.print = function(ast) {
|
||||
return new Handlebars.PrintVisitor().accept(ast);
|
||||
}
|
||||
|
||||
Handlebars.compile = function(string) {
|
||||
var ast = Handlebars.parse(string);
|
||||
|
||||
return function(context, fallback) {
|
||||
var runtime = new Handlebars.Runtime(context, fallback);
|
||||
return runtime.accept(ast);
|
||||
}
|
||||
}
|
||||
|
||||
if(exports) { exports.Handlebars = Handlebars }
|
||||
|
||||
@@ -32,7 +32,6 @@ Handlebars.AST.ContentNode = function(string) {
|
||||
|
||||
Handlebars.AST.IdNode = function(parts) {
|
||||
this.type = "ID"
|
||||
this.parts = parts;
|
||||
|
||||
var dig = [], depth = 0;
|
||||
|
||||
@@ -44,7 +43,7 @@ Handlebars.AST.IdNode = function(parts) {
|
||||
else { dig.push(part) }
|
||||
}
|
||||
|
||||
this.dig = dig;
|
||||
this.parts = dig;
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,11 +96,13 @@ Handlebars.Runtime.prototype = {
|
||||
for(var i=0, l=statements.length; i<l; i++) {
|
||||
this.accept(statements[i]);
|
||||
}
|
||||
|
||||
return this.buffer;
|
||||
},
|
||||
|
||||
mustache: function(mustache) {
|
||||
var idObj = this.accept(mustache.id);
|
||||
var params = this.evaluateParams(mustache.params);
|
||||
var params = mustache.params;
|
||||
|
||||
for(var i=0, l=params.length; i<l; i++) {
|
||||
params[i] = this.accept(params[i]).data;
|
||||
@@ -137,6 +139,8 @@ Handlebars.Runtime.prototype = {
|
||||
this.buffer += content.string;
|
||||
},
|
||||
|
||||
comment: function() {},
|
||||
|
||||
evaluateParams: function(params) {
|
||||
for(var i=0, l=params.length; i<l; i++) {
|
||||
params[i] = this.accept(params[i]).data;
|
||||
|
||||
Reference in New Issue
Block a user