mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-10-30 23:23:02 +00:00 
			
		
		
		
	Refactoring renderer "tree" array to "nodes"
This commit is contained in:
		| @@ -60,7 +60,7 @@ JavaScriptParser.prototype.parse = function(type,code) { | |||||||
| 				classes.push("javascript-line-comment"); | 				classes.push("javascript-line-comment"); | ||||||
| 				content.push(Renderer.TextNode("//")); | 				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") { | 			if(comment.type === "Block") { | ||||||
| 				content.push(Renderer.TextNode("*/")); | 				content.push(Renderer.TextNode("*/")); | ||||||
| 			} else { | 			} else { | ||||||
|   | |||||||
| @@ -15,8 +15,8 @@ var utils = require("./Utils.js"), | |||||||
| 	esprima = require("esprima"); | 	esprima = require("esprima"); | ||||||
|  |  | ||||||
| // Intialise the renderer object | // Intialise the renderer object | ||||||
| var Renderer = function(tree,dependencies,store) { | var Renderer = function(nodes,dependencies,store) { | ||||||
| 	this.tree = tree; | 	this.nodes = nodes; | ||||||
| 	this.dependencies = dependencies; | 	this.dependencies = dependencies; | ||||||
| 	this.store = store; | 	this.store = store; | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -420,7 +420,7 @@ var rules = [ | |||||||
| 			w.nextMatch = oldNextMatch; | 			w.nextMatch = oldNextMatch; | ||||||
| 			w.children = oldChildren; | 			w.children = oldChildren; | ||||||
| 			w.dependencies = oldDependencies; | 			w.dependencies = oldDependencies; | ||||||
| 			w.output.push.apply(w.output,parseTree.tree); | 			w.output.push.apply(w.output,parseTree.nodes); | ||||||
| 			w.nextMatch = this.lookaheadRegExp.lastIndex; | 			w.nextMatch = this.lookaheadRegExp.lastIndex; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ exports.macro = { | |||||||
| 	}, | 	}, | ||||||
| 	execute: function() { | 	execute: function() { | ||||||
| 		if(this.store.tiddlerExists(this.params.src)) { | 		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 = []; | 				cloneImage = []; | ||||||
| 			for(var t=0; t<imageTree.length; t++) { | 			for(var t=0; t<imageTree.length; t++) { | ||||||
| 				cloneImage.push(imageTree[t].clone()); | 				cloneImage.push(imageTree[t].clone()); | ||||||
|   | |||||||
| @@ -60,7 +60,7 @@ exports.macro = { | |||||||
| 		if(tiddlers.length === 0) { | 		if(tiddlers.length === 0) { | ||||||
| 			return [Renderer.TextNode(this.params.emptyMessage || "")]; | 			return [Renderer.TextNode(this.params.emptyMessage || "")]; | ||||||
| 		} else { | 		} else { | ||||||
| 			var templateTree = this.store.parseText(templateType,templateText).tree; | 			var templateTree = this.store.parseText(templateType,templateText).nodes; | ||||||
| 			for(t=0; t<tiddlers.length; t++) { | 			for(t=0; t<tiddlers.length; t++) { | ||||||
| 				var cloneTemplate = []; | 				var cloneTemplate = []; | ||||||
| 				for(var c=0; c<templateTree.length; c++) { | 				for(var c=0; c<templateTree.length; c++) { | ||||||
|   | |||||||
| @@ -42,7 +42,7 @@ exports.macro = { | |||||||
| 				target = this.params.targetTiddler, | 				target = this.params.targetTiddler, | ||||||
| 				sliderContent; | 				sliderContent; | ||||||
| 			if(this.params.hasOwnProperty("content")) { | 			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 { | 			} else { | ||||||
| 				sliderContent = [Renderer.MacroNode( | 				sliderContent = [Renderer.MacroNode( | ||||||
| 										"tiddler", | 										"tiddler", | ||||||
|   | |||||||
| @@ -77,11 +77,11 @@ exports.macro = { | |||||||
| 					var placeholderRegExp = new RegExp("\\$"+(t+1),"mg"); | 					var placeholderRegExp = new RegExp("\\$"+(t+1),"mg"); | ||||||
| 					text = text.replace(placeholderRegExp,withTokens[t]); | 					text = text.replace(placeholderRegExp,withTokens[t]); | ||||||
| 				} | 				} | ||||||
| 				content = this.store.parseText(targetTiddler.type,text).tree; | 				content = this.store.parseText(targetTiddler.type,text).nodes; | ||||||
| 			} else { | 			} else { | ||||||
| 				// There's no parameterisation, so we can just render the target tiddler directly | 				// There's no parameterisation, so we can just render the target tiddler directly | ||||||
| 				var parseTree = this.store.parseTiddler(renderTemplate); | 				var parseTree = this.store.parseTiddler(renderTemplate); | ||||||
| 				content = parseTree ? parseTree.tree : []; | 				content = parseTree ? parseTree.nodes : []; | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| 			content = [Renderer.ErrorNode("Tiddler recursion error in <<tiddler>> macro")];	 | 			content = [Renderer.ErrorNode("Tiddler recursion error in <<tiddler>> macro")];	 | ||||||
|   | |||||||
| @@ -41,14 +41,14 @@ exports.macro = { | |||||||
| 					case "wikified": | 					case "wikified": | ||||||
| 						if(this.params.field === "text") { | 						if(this.params.field === "text") { | ||||||
| 							if(parents.indexOf(tiddler.title) === -1) { | 							if(parents.indexOf(tiddler.title) === -1) { | ||||||
| 								content = this.store.parseTiddler(tiddler.title).tree; | 								content = this.store.parseTiddler(tiddler.title).nodes; | ||||||
| 							} else { | 							} else { | ||||||
| 								content = [Renderer.ErrorNode("Tiddler recursion error in <<view>> macro")]; | 								content = [Renderer.ErrorNode("Tiddler recursion error in <<view>> macro")]; | ||||||
| 							} | 							} | ||||||
| 							parents = parents.slice(0); | 							parents = parents.slice(0); | ||||||
| 							parents.push(tiddler.title); | 							parents.push(tiddler.title); | ||||||
| 						} else { | 						} 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++) { | 						for(t=0; t<content.length; t++) { | ||||||
| 							contentClone.push(content[t].clone()); | 							contentClone.push(content[t].clone()); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jeremy Ruston
					Jeremy Ruston