Fix a number of outstanding issues:
* {{}} escape their contents, {{{}}} and {{& }} do not
* Add support in the parser, tokenizer and AST for partials
with context (support is still not there in the runtime)
* Fix some inconsistencies with the old behavior involving
the correct printing of null and undefined
* Add Handlebars.Exception
* Fixed an issue involving ./foo and this/foo
* Fleshed out helperMissing in the specs (this will be
moved out into handlebars proper once registerHelper
and registerPartial are added)
This commit is contained in:
+10
-1
@@ -1,11 +1,20 @@
|
||||
module("basic context");
|
||||
|
||||
var helperMissing = function(context, fn) {
|
||||
var ret = "";
|
||||
|
||||
if(context === true) {
|
||||
return fn(this);
|
||||
} else if(context === false) {
|
||||
return "";
|
||||
}
|
||||
} else if(Object.prototype.toString.call(context) === "[object Array]") {
|
||||
for(var i=0, j=context.length; i<j; i++) {
|
||||
ret = ret + fn(context[i]);
|
||||
}
|
||||
return ret;
|
||||
} else {
|
||||
return fn(context);
|
||||
}
|
||||
}
|
||||
|
||||
var shouldCompileTo = function(string, hash, expected, message) {
|
||||
|
||||
Reference in New Issue
Block a user