Restructure files to make more sense in a non-CommonJS world.
This commit is contained in:
+16
-13
@@ -1,9 +1,12 @@
|
||||
if(exports) { var Visitor = require("handlebars/jison_ext").Visitor }
|
||||
if(exports) {
|
||||
var Handlebars = {};
|
||||
Handlebars.Visitor = require("handlebars/jison_ext").Visitor
|
||||
}
|
||||
|
||||
PrintVisitor = function() { this.padding = 0; };
|
||||
PrintVisitor.prototype = new Visitor;
|
||||
Handlebars.PrintVisitor = function() { this.padding = 0; };
|
||||
Handlebars.PrintVisitor.prototype = new Handlebars.Visitor;
|
||||
|
||||
PrintVisitor.prototype.pad = function(string, newline) {
|
||||
Handlebars.PrintVisitor.prototype.pad = function(string, newline) {
|
||||
var out = "";
|
||||
|
||||
for(var i=0,l=this.padding; i<l; i++) {
|
||||
@@ -16,7 +19,7 @@ PrintVisitor.prototype.pad = function(string, newline) {
|
||||
return out;
|
||||
};
|
||||
|
||||
PrintVisitor.prototype.program = function(program) {
|
||||
Handlebars.PrintVisitor.prototype.program = function(program) {
|
||||
var out = this.pad("PROGRAM:"),
|
||||
statements = program.statements,
|
||||
inverse = program.inverse;
|
||||
@@ -44,7 +47,7 @@ PrintVisitor.prototype.program = function(program) {
|
||||
return out;
|
||||
};
|
||||
|
||||
PrintVisitor.prototype.block = function(block) {
|
||||
Handlebars.PrintVisitor.prototype.block = function(block) {
|
||||
var out = "";
|
||||
|
||||
out = out + this.pad("BLOCK:");
|
||||
@@ -56,7 +59,7 @@ PrintVisitor.prototype.block = function(block) {
|
||||
return out;
|
||||
};
|
||||
|
||||
PrintVisitor.prototype.mustache = function(mustache) {
|
||||
Handlebars.PrintVisitor.prototype.mustache = function(mustache) {
|
||||
var params = mustache.params, paramStrings = [];
|
||||
|
||||
for(var i=0, l=params.length; i<l; i++) {
|
||||
@@ -67,26 +70,26 @@ PrintVisitor.prototype.mustache = function(mustache) {
|
||||
return this.pad("{{ " + this.accept(mustache.id) + " " + params + "}}");
|
||||
};
|
||||
|
||||
PrintVisitor.prototype.partial = function(partial) {
|
||||
Handlebars.PrintVisitor.prototype.partial = function(partial) {
|
||||
return this.pad("{{> " + this.accept(partial.id) + " }}");
|
||||
};
|
||||
|
||||
PrintVisitor.prototype.STRING = function(string) {
|
||||
Handlebars.PrintVisitor.prototype.STRING = function(string) {
|
||||
return string.string;
|
||||
};
|
||||
|
||||
PrintVisitor.prototype.ID = function(id) {
|
||||
Handlebars.PrintVisitor.prototype.ID = function(id) {
|
||||
return "ID:" + id.id;
|
||||
};
|
||||
|
||||
PrintVisitor.prototype.content = function(content) {
|
||||
Handlebars.PrintVisitor.prototype.content = function(content) {
|
||||
return this.pad("CONTENT[ '" + content.string + "' ]");
|
||||
};
|
||||
|
||||
PrintVisitor.prototype.comment = function(comment) {
|
||||
Handlebars.PrintVisitor.prototype.comment = function(comment) {
|
||||
return this.pad("{{! '" + comment.comment + "' }}");
|
||||
}
|
||||
|
||||
if(exports) {
|
||||
exports.PrintVisitor = PrintVisitor;
|
||||
exports.PrintVisitor = Handlebars.PrintVisitor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user