Allow subclasses to customize the namespace
This commit is contained in:
@@ -336,6 +336,8 @@ Handlebars.JavaScriptCompiler = function() {};
|
|||||||
initializeBuffer: function() {
|
initializeBuffer: function() {
|
||||||
return this.quotedString("");
|
return this.quotedString("");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
namespace: "Handlebars",
|
||||||
// END PUBLIC API
|
// END PUBLIC API
|
||||||
|
|
||||||
compile: function(environment, options, context, asObject) {
|
compile: function(environment, options, context, asObject) {
|
||||||
@@ -406,8 +408,9 @@ Handlebars.JavaScriptCompiler = function() {};
|
|||||||
var out = [];
|
var out = [];
|
||||||
|
|
||||||
if (!this.isChild) {
|
if (!this.isChild) {
|
||||||
var copies = "helpers = helpers || Handlebars.helpers;";
|
var namespace = this.namespace;
|
||||||
if(this.environment.usePartial) { copies = copies + " partials = partials || Handlebars.partials;"; }
|
var copies = "helpers = helpers || " + namespace + ".helpers;";
|
||||||
|
if(this.environment.usePartial) { copies = copies + " partials = partials || " + namespace + ".partials;"; }
|
||||||
out.push(copies);
|
out.push(copies);
|
||||||
} else {
|
} else {
|
||||||
out.push('');
|
out.push('');
|
||||||
@@ -521,7 +524,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|||||||
+ " || "
|
+ " || "
|
||||||
+ this.nameLookup('depth' + this.lastContext, name, 'context');
|
+ this.nameLookup('depth' + this.lastContext, name, 'context');
|
||||||
}
|
}
|
||||||
|
|
||||||
toPush += ';';
|
toPush += ';';
|
||||||
this.source.push(toPush);
|
this.source.push(toPush);
|
||||||
} else {
|
} else {
|
||||||
@@ -726,7 +729,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|||||||
};
|
};
|
||||||
|
|
||||||
var reservedWords = ("break case catch continue default delete do else finally " +
|
var reservedWords = ("break case catch continue default delete do else finally " +
|
||||||
"for function if in instanceof new return switch this throw " +
|
"for function if in instanceof new return switch this throw " +
|
||||||
"try typeof var void while with null true false").split(" ");
|
"try typeof var void while with null true false").split(" ");
|
||||||
|
|
||||||
var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
|
var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user