Commiting initial factory code
This commit is contained in:
+23
-5
@@ -1,14 +1,32 @@
|
|||||||
var Handlebars = require("./handlebars/base");
|
var handlebars = require("./handlebars/base"),
|
||||||
module.exports = Handlebars;
|
|
||||||
|
|
||||||
// Each of these augment the Handlebars object. No need to setup here.
|
// Each of these augment the Handlebars object. No need to setup here.
|
||||||
// (This is done to easily share code between commonjs and browse envs)
|
// (This is done to easily share code between commonjs and browse envs)
|
||||||
require("./handlebars/utils");
|
utils = require("./handlebars/utils"),
|
||||||
|
compiler = require("./handlebars/compiler"),
|
||||||
|
runtime = require("./handlebars/runtime");
|
||||||
|
|
||||||
require("./handlebars/compiler");
|
var create = function() {
|
||||||
require("./handlebars/runtime");
|
var hb = handlebars.create();
|
||||||
|
|
||||||
|
utils.attach(hb);
|
||||||
|
compiler.attach(hb);
|
||||||
|
runtime.attach(hb);
|
||||||
|
|
||||||
|
return hb;
|
||||||
|
};
|
||||||
|
|
||||||
|
var Handlebars = create();
|
||||||
|
Handlebars.create = create;
|
||||||
|
|
||||||
|
module.exports = Handlebars; // instantiate an instance
|
||||||
|
|
||||||
// BEGIN(BROWSER)
|
// BEGIN(BROWSER)
|
||||||
|
|
||||||
// END(BROWSER)
|
// END(BROWSER)
|
||||||
|
|
||||||
|
// USAGE:
|
||||||
|
// var handlebars = require('handlebars');
|
||||||
|
|
||||||
|
// var singleton = handlebars.Handlebars,
|
||||||
|
// local = handlebars.create();
|
||||||
|
|||||||
+32
-32
@@ -1,35 +1,34 @@
|
|||||||
// BEGIN(BROWSER)
|
module.exports.create = function() {
|
||||||
|
|
||||||
/*jshint eqnull:true*/
|
// BEGIN(BROWSER)
|
||||||
this.Handlebars = {};
|
|
||||||
|
|
||||||
(function(Handlebars) {
|
var Handlebars = {};
|
||||||
|
|
||||||
Handlebars.VERSION = "1.0.rc.1";
|
Handlebars.VERSION = "1.0.rc.1";
|
||||||
|
|
||||||
Handlebars.helpers = {};
|
Handlebars.helpers = {};
|
||||||
Handlebars.partials = {};
|
Handlebars.partials = {};
|
||||||
|
|
||||||
Handlebars.registerHelper = function(name, fn, inverse) {
|
Handlebars.registerHelper = function(name, fn, inverse) {
|
||||||
if(inverse) { fn.not = inverse; }
|
if(inverse) { fn.not = inverse; }
|
||||||
this.helpers[name] = fn;
|
this.helpers[name] = fn;
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.registerPartial = function(name, str) {
|
Handlebars.registerPartial = function(name, str) {
|
||||||
this.partials[name] = str;
|
this.partials[name] = str;
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.registerHelper('helperMissing', function(arg) {
|
Handlebars.registerHelper('helperMissing', function(arg) {
|
||||||
if(arguments.length === 2) {
|
if(arguments.length === 2) {
|
||||||
return undefined;
|
return undefined;
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Could not find property '" + arg + "'");
|
throw new Error("Could not find property '" + arg + "'");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var toString = Object.prototype.toString, functionType = "[object Function]";
|
var toString = Object.prototype.toString, functionType = "[object Function]";
|
||||||
|
|
||||||
Handlebars.registerHelper('blockHelperMissing', function(context, options) {
|
Handlebars.registerHelper('blockHelperMissing', function(context, options) {
|
||||||
var inverse = options.inverse || function() {}, fn = options.fn;
|
var inverse = options.inverse || function() {}, fn = options.fn;
|
||||||
|
|
||||||
|
|
||||||
@@ -54,18 +53,18 @@ Handlebars.registerHelper('blockHelperMissing', function(context, options) {
|
|||||||
} else {
|
} else {
|
||||||
return fn(context);
|
return fn(context);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Handlebars.K = function() {};
|
Handlebars.K = function() {};
|
||||||
|
|
||||||
Handlebars.createFrame = Object.create || function(object) {
|
Handlebars.createFrame = Object.create || function(object) {
|
||||||
Handlebars.K.prototype = object;
|
Handlebars.K.prototype = object;
|
||||||
var obj = new Handlebars.K();
|
var obj = new Handlebars.K();
|
||||||
Handlebars.K.prototype = null;
|
Handlebars.K.prototype = null;
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.registerHelper('each', function(context, options) {
|
Handlebars.registerHelper('each', function(context, options) {
|
||||||
var fn = options.fn, inverse = options.inverse;
|
var fn = options.fn, inverse = options.inverse;
|
||||||
var ret = "", data;
|
var ret = "", data;
|
||||||
|
|
||||||
@@ -82,9 +81,9 @@ Handlebars.registerHelper('each', function(context, options) {
|
|||||||
ret = inverse(this);
|
ret = inverse(this);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
});
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper('if', function(context, options) {
|
Handlebars.registerHelper('if', function(context, options) {
|
||||||
var type = toString.call(context);
|
var type = toString.call(context);
|
||||||
if(type === functionType) { context = context.call(this); }
|
if(type === functionType) { context = context.call(this); }
|
||||||
|
|
||||||
@@ -93,27 +92,28 @@ Handlebars.registerHelper('if', function(context, options) {
|
|||||||
} else {
|
} else {
|
||||||
return options.fn(this);
|
return options.fn(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper('unless', function(context, options) {
|
Handlebars.registerHelper('unless', function(context, options) {
|
||||||
var fn = options.fn, inverse = options.inverse;
|
var fn = options.fn, inverse = options.inverse;
|
||||||
options.fn = inverse;
|
options.fn = inverse;
|
||||||
options.inverse = fn;
|
options.inverse = fn;
|
||||||
|
|
||||||
return Handlebars.helpers['if'].call(this, context, options);
|
return Handlebars.helpers['if'].call(this, context, options);
|
||||||
});
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper('with', function(context, options) {
|
Handlebars.registerHelper('with', function(context, options) {
|
||||||
return options.fn(context);
|
return options.fn(context);
|
||||||
});
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper('log', function(context) {
|
Handlebars.registerHelper('log', function(context) {
|
||||||
Handlebars.log(context);
|
Handlebars.log(context);
|
||||||
});
|
});
|
||||||
|
|
||||||
}(this.Handlebars));
|
// END(BROWSER)
|
||||||
|
|
||||||
// END(BROWSER)
|
return Handlebars;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = this.Handlebars;
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
var Handlebars = require('./base');
|
|
||||||
|
|
||||||
// BEGIN(BROWSER)
|
// BEGIN(BROWSER)
|
||||||
(function() {
|
exports.attach = function(Handlebars) {
|
||||||
|
|
||||||
Handlebars.AST = {};
|
Handlebars.AST = {};
|
||||||
|
|
||||||
@@ -118,6 +117,8 @@ var Handlebars = require('./base');
|
|||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
return Handlebars;
|
||||||
|
};
|
||||||
|
|
||||||
// END(BROWSER)
|
// END(BROWSER)
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,30 @@
|
|||||||
var handlebars = require("./parser").parser;
|
var handlebars = require("./parser").parser;
|
||||||
var Handlebars = require("../base");
|
|
||||||
|
|
||||||
// BEGIN(BROWSER)
|
exports.attach = function(Handlebars) {
|
||||||
Handlebars.Parser = handlebars;
|
|
||||||
|
|
||||||
Handlebars.parse = function(string) {
|
// BEGIN(BROWSER)
|
||||||
|
|
||||||
|
Handlebars.Parser = handlebars;
|
||||||
|
|
||||||
|
Handlebars.parse = function(string) {
|
||||||
Handlebars.Parser.yy = Handlebars.AST;
|
Handlebars.Parser.yy = Handlebars.AST;
|
||||||
return Handlebars.Parser.parse(string);
|
return Handlebars.Parser.parse(string);
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.print = function(ast) {
|
Handlebars.print = function(ast) {
|
||||||
return new Handlebars.PrintVisitor().accept(ast);
|
return new Handlebars.PrintVisitor().accept(ast);
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.logger = {
|
Handlebars.logger = {
|
||||||
DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,
|
DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,
|
||||||
|
|
||||||
// override in the host environment
|
// override in the host environment
|
||||||
log: function(level, str) {}
|
log: function(level, str) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
Handlebars.log = function(level, str) { Handlebars.logger.log(level, str); };
|
||||||
|
|
||||||
|
return Handlebars;
|
||||||
|
|
||||||
|
// END(BROWSER)
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.log = function(level, str) { Handlebars.logger.log(level, str); };
|
|
||||||
|
|
||||||
// END(BROWSER)
|
|
||||||
|
|
||||||
module.exports = Handlebars;
|
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
var Handlebars = require("./base");
|
|
||||||
|
|
||||||
|
|
||||||
|
exports.attach = function(Handlebars) {
|
||||||
|
|
||||||
// BEGIN(BROWSER)
|
// BEGIN(BROWSER)
|
||||||
|
|
||||||
/*jshint eqnull:true*/
|
/*jshint eqnull:true*/
|
||||||
Handlebars.Compiler = function() {};
|
Handlebars.Compiler = function() {};
|
||||||
Handlebars.JavaScriptCompiler = function() {};
|
Handlebars.JavaScriptCompiler = function() {};
|
||||||
|
|
||||||
(function(Compiler, JavaScriptCompiler) {
|
(function(Compiler, JavaScriptCompiler) {
|
||||||
// the foundHelper register will disambiguate helper lookup from finding a
|
// the foundHelper register will disambiguate helper lookup from finding a
|
||||||
// function in a context. This is necessary for mustache compatibility, which
|
// function in a context. This is necessary for mustache compatibility, which
|
||||||
// requires that context functions in blocks are evaluated by blockHelperMissing,
|
// requires that context functions in blocks are evaluated by blockHelperMissing,
|
||||||
@@ -1032,17 +1035,17 @@ Handlebars.JavaScriptCompiler = function() {};
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
})(Handlebars.Compiler, Handlebars.JavaScriptCompiler);
|
})(Handlebars.Compiler, Handlebars.JavaScriptCompiler);
|
||||||
|
|
||||||
Handlebars.precompile = function(string, options) {
|
Handlebars.precompile = function(string, options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
var ast = Handlebars.parse(string);
|
var ast = Handlebars.parse(string);
|
||||||
var environment = new Handlebars.Compiler().compile(ast, options);
|
var environment = new Handlebars.Compiler().compile(ast, options);
|
||||||
return new Handlebars.JavaScriptCompiler().compile(environment, options);
|
return new Handlebars.JavaScriptCompiler().compile(environment, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.compile = function(string, options) {
|
Handlebars.compile = function(string, options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
var compiled;
|
var compiled;
|
||||||
@@ -1060,7 +1063,13 @@ Handlebars.compile = function(string, options) {
|
|||||||
}
|
}
|
||||||
return compiled.call(this, context, options);
|
return compiled.call(this, context, options);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// END(BROWSER)
|
||||||
|
|
||||||
|
return Handlebars;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// END(BROWSER)
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,16 @@
|
|||||||
// Each of these module will augment the Handlebars object as it loads. No need to perform addition operations
|
// Each of these module will augment the Handlebars object as it loads. No need to perform addition operations
|
||||||
module.exports = require("./base");
|
module.exports.attach = function(Handlebars) {
|
||||||
require("./visitor");
|
|
||||||
require("./printer");
|
|
||||||
|
|
||||||
require("./ast");
|
var visitor = require("./visitor"),
|
||||||
require("./compiler");
|
printer = require("./printer"),
|
||||||
|
ast = require("./ast"),
|
||||||
|
compiler = require("./compiler");
|
||||||
|
|
||||||
|
visitor.attach(Handlebars);
|
||||||
|
printer.attach(Handlebars);
|
||||||
|
ast.attach(Handlebars);
|
||||||
|
compiler.attach(Handlebars);
|
||||||
|
|
||||||
|
return Handlebars;
|
||||||
|
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
var Handlebars = require("./base");
|
exports.attach = function(Handlebars) {
|
||||||
|
|
||||||
// BEGIN(BROWSER)
|
// BEGIN(BROWSER)
|
||||||
Handlebars.PrintVisitor = function() { this.padding = 0; };
|
|
||||||
Handlebars.PrintVisitor.prototype = new Handlebars.Visitor();
|
|
||||||
|
|
||||||
Handlebars.PrintVisitor.prototype.pad = function(string, newline) {
|
Handlebars.PrintVisitor = function() { this.padding = 0; };
|
||||||
|
Handlebars.PrintVisitor.prototype = new Handlebars.Visitor();
|
||||||
|
|
||||||
|
Handlebars.PrintVisitor.prototype.pad = function(string, newline) {
|
||||||
var out = "";
|
var out = "";
|
||||||
|
|
||||||
for(var i=0,l=this.padding; i<l; i++) {
|
for(var i=0,l=this.padding; i<l; i++) {
|
||||||
@@ -15,9 +16,9 @@ Handlebars.PrintVisitor.prototype.pad = function(string, newline) {
|
|||||||
|
|
||||||
if(newline !== false) { out = out + "\n"; }
|
if(newline !== false) { out = out + "\n"; }
|
||||||
return out;
|
return out;
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.PrintVisitor.prototype.program = function(program) {
|
Handlebars.PrintVisitor.prototype.program = function(program) {
|
||||||
var out = "",
|
var out = "",
|
||||||
statements = program.statements,
|
statements = program.statements,
|
||||||
inverse = program.inverse,
|
inverse = program.inverse,
|
||||||
@@ -30,9 +31,9 @@ Handlebars.PrintVisitor.prototype.program = function(program) {
|
|||||||
this.padding--;
|
this.padding--;
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.PrintVisitor.prototype.block = function(block) {
|
Handlebars.PrintVisitor.prototype.block = function(block) {
|
||||||
var out = "";
|
var out = "";
|
||||||
|
|
||||||
out = out + this.pad("BLOCK:");
|
out = out + this.pad("BLOCK:");
|
||||||
@@ -55,9 +56,9 @@ Handlebars.PrintVisitor.prototype.block = function(block) {
|
|||||||
this.padding--;
|
this.padding--;
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.PrintVisitor.prototype.mustache = function(mustache) {
|
Handlebars.PrintVisitor.prototype.mustache = function(mustache) {
|
||||||
var params = mustache.params, paramStrings = [], hash;
|
var params = mustache.params, paramStrings = [], hash;
|
||||||
|
|
||||||
for(var i=0, l=params.length; i<l; i++) {
|
for(var i=0, l=params.length; i<l; i++) {
|
||||||
@@ -69,15 +70,15 @@ Handlebars.PrintVisitor.prototype.mustache = function(mustache) {
|
|||||||
hash = mustache.hash ? " " + this.accept(mustache.hash) : "";
|
hash = mustache.hash ? " " + this.accept(mustache.hash) : "";
|
||||||
|
|
||||||
return this.pad("{{ " + this.accept(mustache.id) + " " + params + hash + " }}");
|
return this.pad("{{ " + this.accept(mustache.id) + " " + params + hash + " }}");
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.PrintVisitor.prototype.partial = function(partial) {
|
Handlebars.PrintVisitor.prototype.partial = function(partial) {
|
||||||
var content = this.accept(partial.id);
|
var content = this.accept(partial.id);
|
||||||
if(partial.context) { content = content + " " + this.accept(partial.context); }
|
if(partial.context) { content = content + " " + this.accept(partial.context); }
|
||||||
return this.pad("{{> " + content + " }}");
|
return this.pad("{{> " + content + " }}");
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.PrintVisitor.prototype.hash = function(hash) {
|
Handlebars.PrintVisitor.prototype.hash = function(hash) {
|
||||||
var pairs = hash.pairs;
|
var pairs = hash.pairs;
|
||||||
var joinedPairs = [], left, right;
|
var joinedPairs = [], left, right;
|
||||||
|
|
||||||
@@ -88,40 +89,42 @@ Handlebars.PrintVisitor.prototype.hash = function(hash) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return "HASH{" + joinedPairs.join(", ") + "}";
|
return "HASH{" + joinedPairs.join(", ") + "}";
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.PrintVisitor.prototype.STRING = function(string) {
|
Handlebars.PrintVisitor.prototype.STRING = function(string) {
|
||||||
return '"' + string.string + '"';
|
return '"' + string.string + '"';
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.PrintVisitor.prototype.INTEGER = function(integer) {
|
Handlebars.PrintVisitor.prototype.INTEGER = function(integer) {
|
||||||
return "INTEGER{" + integer.integer + "}";
|
return "INTEGER{" + integer.integer + "}";
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.PrintVisitor.prototype.BOOLEAN = function(bool) {
|
Handlebars.PrintVisitor.prototype.BOOLEAN = function(bool) {
|
||||||
return "BOOLEAN{" + bool.bool + "}";
|
return "BOOLEAN{" + bool.bool + "}";
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.PrintVisitor.prototype.ID = function(id) {
|
Handlebars.PrintVisitor.prototype.ID = function(id) {
|
||||||
var path = id.parts.join("/");
|
var path = id.parts.join("/");
|
||||||
if(id.parts.length > 1) {
|
if(id.parts.length > 1) {
|
||||||
return "PATH:" + path;
|
return "PATH:" + path;
|
||||||
} else {
|
} else {
|
||||||
return "ID:" + path;
|
return "ID:" + path;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.PrintVisitor.prototype.DATA = function(data) {
|
Handlebars.PrintVisitor.prototype.DATA = function(data) {
|
||||||
return "@" + data.id;
|
return "@" + data.id;
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.PrintVisitor.prototype.content = function(content) {
|
Handlebars.PrintVisitor.prototype.content = function(content) {
|
||||||
return this.pad("CONTENT[ '" + content.string + "' ]");
|
return this.pad("CONTENT[ '" + content.string + "' ]");
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.PrintVisitor.prototype.comment = function(comment) {
|
Handlebars.PrintVisitor.prototype.comment = function(comment) {
|
||||||
return this.pad("{{! '" + comment.comment + "' }}");
|
return this.pad("{{! '" + comment.comment + "' }}");
|
||||||
};
|
};
|
||||||
// END(BROWSER)
|
// END(BROWSER)
|
||||||
|
|
||||||
|
return Handlebars;
|
||||||
|
};
|
||||||
|
|
||||||
exports.PrintVisitor = Handlebars.PrintVisitor;
|
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
var Handlebars = require("./base");
|
|
||||||
|
|
||||||
// BEGIN(BROWSER)
|
exports.attach = function(Handlebars) {
|
||||||
|
|
||||||
Handlebars.Visitor = function() {};
|
// BEGIN(BROWSER)
|
||||||
|
|
||||||
Handlebars.Visitor.prototype = {
|
Handlebars.Visitor = function() {};
|
||||||
|
|
||||||
|
Handlebars.Visitor.prototype = {
|
||||||
accept: function(object) {
|
accept: function(object) {
|
||||||
return this[object.type](object);
|
return this[object.type](object);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// END(BROWSER)
|
|
||||||
|
// END(BROWSER)
|
||||||
|
|
||||||
|
return Handlebars;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
var Handlebars = require("./base");
|
exports.attach = function(Handlebars) {
|
||||||
|
|
||||||
// BEGIN(BROWSER)
|
// BEGIN(BROWSER)
|
||||||
Handlebars.VM = {
|
|
||||||
|
Handlebars.VM = {
|
||||||
template: function(templateSpec) {
|
template: function(templateSpec) {
|
||||||
// Just add water
|
// Just add water
|
||||||
var container = {
|
var container = {
|
||||||
@@ -60,9 +61,12 @@ Handlebars.VM = {
|
|||||||
return partials[name](context, options);
|
return partials[name](context, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Handlebars.template = Handlebars.VM.template;
|
||||||
|
|
||||||
|
// END(BROWSER)
|
||||||
|
|
||||||
|
return Handlebars;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Handlebars.template = Handlebars.VM.template;
|
|
||||||
|
|
||||||
// END(BROWSER)
|
|
||||||
|
|
||||||
|
|||||||
+17
-13
@@ -1,7 +1,8 @@
|
|||||||
var Handlebars = require("./base");
|
exports.attach = function(Handlebars) {
|
||||||
|
|
||||||
// BEGIN(BROWSER)
|
// BEGIN(BROWSER)
|
||||||
Handlebars.Exception = function(message) {
|
|
||||||
|
Handlebars.Exception = function(message) {
|
||||||
var tmp = Error.prototype.constructor.apply(this, arguments);
|
var tmp = Error.prototype.constructor.apply(this, arguments);
|
||||||
|
|
||||||
for (var p in tmp) {
|
for (var p in tmp) {
|
||||||
@@ -9,18 +10,18 @@ Handlebars.Exception = function(message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.message = tmp.message;
|
this.message = tmp.message;
|
||||||
};
|
};
|
||||||
Handlebars.Exception.prototype = new Error();
|
Handlebars.Exception.prototype = new Error();
|
||||||
|
|
||||||
// Build out our basic SafeString type
|
// Build out our basic SafeString type
|
||||||
Handlebars.SafeString = function(string) {
|
Handlebars.SafeString = function(string) {
|
||||||
this.string = string;
|
this.string = string;
|
||||||
};
|
};
|
||||||
Handlebars.SafeString.prototype.toString = function() {
|
Handlebars.SafeString.prototype.toString = function() {
|
||||||
return this.string.toString();
|
return this.string.toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var escape = {
|
var escape = {
|
||||||
"<": "<",
|
"<": "<",
|
||||||
">": ">",
|
">": ">",
|
||||||
@@ -63,6 +64,9 @@ Handlebars.SafeString.prototype.toString = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
// END(BROWSER)
|
|
||||||
|
|
||||||
|
// END(BROWSER)
|
||||||
|
|
||||||
|
return Handlebars;
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user