1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-02-22 14:00:03 +00:00

Refactoring renderer "tree" array to "nodes"

This commit is contained in:
Jeremy Ruston 2012-03-03 18:39:13 +00:00
parent 2ecb1f670c
commit 4a73317193
8 changed files with 11 additions and 11 deletions

View File

@ -60,7 +60,7 @@ JavaScriptParser.prototype.parse = function(type,code) {
classes.push("javascript-line-comment");
content.push(Renderer.TextNode("//"));
}
content.push.apply(content,self.store.parseText("text/x-tiddlywiki",text).tree);
content.push.apply(content,self.store.parseText("text/x-tiddlywiki",text).nodes);
if(comment.type === "Block") {
content.push(Renderer.TextNode("*/"));
} else {

View File

@ -15,8 +15,8 @@ var utils = require("./Utils.js"),
esprima = require("esprima");
// Intialise the renderer object
var Renderer = function(tree,dependencies,store) {
this.tree = tree;
var Renderer = function(nodes,dependencies,store) {
this.nodes = nodes;
this.dependencies = dependencies;
this.store = store;
};

View File

@ -420,7 +420,7 @@ var rules = [
w.nextMatch = oldNextMatch;
w.children = oldChildren;
w.dependencies = oldDependencies;
w.output.push.apply(w.output,parseTree.tree);
w.output.push.apply(w.output,parseTree.nodes);
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}

View File

@ -19,7 +19,7 @@ exports.macro = {
},
execute: function() {
if(this.store.tiddlerExists(this.params.src)) {
var imageTree = this.store.parseTiddler(this.params.src).tree,
var imageTree = this.store.parseTiddler(this.params.src).nodes,
cloneImage = [];
for(var t=0; t<imageTree.length; t++) {
cloneImage.push(imageTree[t].clone());

View File

@ -60,7 +60,7 @@ exports.macro = {
if(tiddlers.length === 0) {
return [Renderer.TextNode(this.params.emptyMessage || "")];
} else {
var templateTree = this.store.parseText(templateType,templateText).tree;
var templateTree = this.store.parseText(templateType,templateText).nodes;
for(t=0; t<tiddlers.length; t++) {
var cloneTemplate = [];
for(var c=0; c<templateTree.length; c++) {

View File

@ -42,7 +42,7 @@ exports.macro = {
target = this.params.targetTiddler,
sliderContent;
if(this.params.hasOwnProperty("content")) {
sliderContent = this.store.parseText("text/x-tiddlywiki",this.params.content).tree;
sliderContent = this.store.parseText("text/x-tiddlywiki",this.params.content).nodes;
} else {
sliderContent = [Renderer.MacroNode(
"tiddler",

View File

@ -77,11 +77,11 @@ exports.macro = {
var placeholderRegExp = new RegExp("\\$"+(t+1),"mg");
text = text.replace(placeholderRegExp,withTokens[t]);
}
content = this.store.parseText(targetTiddler.type,text).tree;
content = this.store.parseText(targetTiddler.type,text).nodes;
} else {
// There's no parameterisation, so we can just render the target tiddler directly
var parseTree = this.store.parseTiddler(renderTemplate);
content = parseTree ? parseTree.tree : [];
content = parseTree ? parseTree.nodes : [];
}
} else {
content = [Renderer.ErrorNode("Tiddler recursion error in <<tiddler>> macro")];

View File

@ -41,14 +41,14 @@ exports.macro = {
case "wikified":
if(this.params.field === "text") {
if(parents.indexOf(tiddler.title) === -1) {
content = this.store.parseTiddler(tiddler.title).tree;
content = this.store.parseTiddler(tiddler.title).nodes;
} else {
content = [Renderer.ErrorNode("Tiddler recursion error in <<view>> macro")];
}
parents = parents.slice(0);
parents.push(tiddler.title);
} else {
content = this.store.parseText("text/x-tiddlywiki",v).tree;
content = this.store.parseText("text/x-tiddlywiki",v).nodes;
}
for(t=0; t<content.length; t++) {
contentClone.push(content[t].clone());