2012-04-30 11:23:03 +00:00
|
|
|
/*\
|
2012-05-03 20:47:16 +00:00
|
|
|
title: $:/core/modules/renderer.js
|
2012-04-30 11:23:03 +00:00
|
|
|
type: application/javascript
|
|
|
|
module-type: global
|
|
|
|
|
|
|
|
Represents a parse tree and associated data
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
2012-05-04 17:49:04 +00:00
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
2012-04-30 11:23:03 +00:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var Renderer = function(tree,dependencies) {
|
|
|
|
this.tree = tree;
|
|
|
|
this.dependencies = dependencies;
|
|
|
|
};
|
|
|
|
|
|
|
|
Renderer.prototype.execute = function(parents,tiddlerTitle) {
|
|
|
|
for(var t=0; t<this.tree.length; t++) {
|
|
|
|
this.tree[t].execute(parents,tiddlerTitle);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Renderer.prototype.render = function(type) {
|
|
|
|
var output = [];
|
|
|
|
for(var t=0; t<this.tree.length; t++) {
|
|
|
|
output.push(this.tree[t].render(type));
|
|
|
|
}
|
|
|
|
return output.join("");
|
|
|
|
};
|
|
|
|
|
|
|
|
Renderer.prototype.renderInDom = function(parentDomNode,insertBefore) {
|
|
|
|
for(var t=0; t<this.tree.length; t++) {
|
|
|
|
this.tree[t].renderInDom(parentDomNode,insertBefore);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Renderer.prototype.refreshInDom = function(changes) {
|
|
|
|
for(var t=0; t<this.tree.length; t++) {
|
|
|
|
this.tree[t].refreshInDom(changes);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.Renderer = Renderer;
|
|
|
|
|
|
|
|
})();
|