mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 21:39:57 +00:00
49 lines
1017 B
JavaScript
49 lines
1017 B
JavaScript
/*\
|
|
title: $:/core/modules/renderer.js
|
|
type: application/javascript
|
|
module-type: global
|
|
|
|
Represents a parse tree and associated data
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"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;
|
|
|
|
})();
|