Initial commit. Note that I'm using CommonJS modules and node purely to help me develop this. If this ends up being useful, I will likely distribute the entire package as a single JS file for easier consumption in the browser.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
var ProgramNode = function(statements, inverse) {
|
||||
this.type = "program";
|
||||
this.statements = statements;
|
||||
this.inverse = inverse;
|
||||
};
|
||||
|
||||
var MustacheNode = function(params) {
|
||||
this.type = "mustache";
|
||||
this.id = params[0];
|
||||
this.params = params.slice(1);
|
||||
};
|
||||
|
||||
var PartialNode = function(id) {
|
||||
this.type = "partial";
|
||||
this.id = id;
|
||||
};
|
||||
|
||||
var BlockNode = function(mustache, program) {
|
||||
this.type = "block";
|
||||
this.mustache = mustache;
|
||||
this.program = program;
|
||||
};
|
||||
|
||||
var ContentNode = function(string) {
|
||||
this.type = "content";
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
var IdNode = function(id) {
|
||||
this.type = "ID"
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
StringNode = function(string) {
|
||||
this.type = "STRING";
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
CommentNode = function(comment) {
|
||||
this.type = "comment";
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
if(exports) {
|
||||
exports.ProgramNode = ProgramNode;
|
||||
exports.MustacheNode = MustacheNode;
|
||||
exports.ContentNode = ContentNode;
|
||||
exports.IdNode = IdNode;
|
||||
exports.StringNode = StringNode;
|
||||
exports.PartialNode = PartialNode;
|
||||
exports.CommentNode = CommentNode;
|
||||
exports.BlockNode = BlockNode;
|
||||
}
|
||||
Reference in New Issue
Block a user