Commiting initial factory code

This commit is contained in:
Tommy Messbauer
2012-08-29 12:48:22 -05:00
parent 89f5ab8aaf
commit 7c4813b417
10 changed files with 1425 additions and 1367 deletions
+23 -5
View File
@@ -1,14 +1,32 @@
var Handlebars = require("./handlebars/base");
module.exports = Handlebars;
var handlebars = require("./handlebars/base"),
// Each of these augment the Handlebars object. No need to setup here.
// (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");
require("./handlebars/runtime");
var create = function() {
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)
// END(BROWSER)
// USAGE:
// var handlebars = require('handlebars');
// var singleton = handlebars.Handlebars,
// local = handlebars.create();
+7 -7
View File
@@ -1,9 +1,8 @@
module.exports.create = function() {
// BEGIN(BROWSER)
/*jshint eqnull:true*/
this.Handlebars = {};
(function(Handlebars) {
var Handlebars = {};
Handlebars.VERSION = "1.0.rc.1";
@@ -111,9 +110,10 @@ Handlebars.registerHelper('log', function(context) {
Handlebars.log(context);
});
}(this.Handlebars));
// END(BROWSER)
module.exports = this.Handlebars;
return Handlebars;
};
+4 -3
View File
@@ -1,7 +1,6 @@
var Handlebars = require('./base');
// BEGIN(BROWSER)
(function() {
exports.attach = function(Handlebars) {
Handlebars.AST = {};
@@ -118,6 +117,8 @@ var Handlebars = require('./base');
this.comment = comment;
};
})();
return Handlebars;
};
// END(BROWSER)
+6 -3
View File
@@ -1,7 +1,9 @@
var handlebars = require("./parser").parser;
var Handlebars = require("../base");
exports.attach = function(Handlebars) {
// BEGIN(BROWSER)
Handlebars.Parser = handlebars;
Handlebars.parse = function(string) {
@@ -22,6 +24,7 @@ Handlebars.logger = {
Handlebars.log = function(level, str) { Handlebars.logger.log(level, str); };
// END(BROWSER)
return Handlebars;
module.exports = Handlebars;
// END(BROWSER)
};
+10 -1
View File
@@ -1,4 +1,7 @@
var Handlebars = require("./base");
exports.attach = function(Handlebars) {
// BEGIN(BROWSER)
@@ -1062,5 +1065,11 @@ Handlebars.compile = function(string, options) {
};
};
// END(BROWSER)
return Handlebars;
};
+14 -5
View File
@@ -1,7 +1,16 @@
// Each of these module will augment the Handlebars object as it loads. No need to perform addition operations
module.exports = require("./base");
require("./visitor");
require("./printer");
module.exports.attach = function(Handlebars) {
require("./ast");
require("./compiler");
var visitor = require("./visitor"),
printer = require("./printer"),
ast = require("./ast"),
compiler = require("./compiler");
visitor.attach(Handlebars);
printer.attach(Handlebars);
ast.attach(Handlebars);
compiler.attach(Handlebars);
return Handlebars;
};
+5 -2
View File
@@ -1,6 +1,7 @@
var Handlebars = require("./base");
exports.attach = function(Handlebars) {
// BEGIN(BROWSER)
Handlebars.PrintVisitor = function() { this.padding = 0; };
Handlebars.PrintVisitor.prototype = new Handlebars.Visitor();
@@ -124,4 +125,6 @@ Handlebars.PrintVisitor.prototype.comment = function(comment) {
};
// END(BROWSER)
exports.PrintVisitor = Handlebars.PrintVisitor;
return Handlebars;
};
+8 -1
View File
@@ -1,4 +1,5 @@
var Handlebars = require("./base");
exports.attach = function(Handlebars) {
// BEGIN(BROWSER)
@@ -9,5 +10,11 @@ Handlebars.Visitor.prototype = {
return this[object.type](object);
}
};
// END(BROWSER)
return Handlebars;
};
+5 -1
View File
@@ -1,6 +1,7 @@
var Handlebars = require("./base");
exports.attach = function(Handlebars) {
// BEGIN(BROWSER)
Handlebars.VM = {
template: function(templateSpec) {
// Just add water
@@ -66,3 +67,6 @@ Handlebars.template = Handlebars.VM.template;
// END(BROWSER)
return Handlebars;
};
+5 -1
View File
@@ -1,6 +1,7 @@
var Handlebars = require("./base");
exports.attach = function(Handlebars) {
// BEGIN(BROWSER)
Handlebars.Exception = function(message) {
var tmp = Error.prototype.constructor.apply(this, arguments);
@@ -64,5 +65,8 @@ Handlebars.SafeString.prototype.toString = function() {
}
};
})();
// END(BROWSER)
return Handlebars;
};