1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 13:29:56 +00:00

Refactored renderTiddler() to create macro node directly

This is so that we can get rid of the Renderer() wrapper class entirely
This commit is contained in:
Jeremy Ruston 2012-02-20 18:04:50 +00:00
parent 36f61b4321
commit b1a96d8bf5

View File

@ -14,6 +14,7 @@ WikiStore uses the .cache member of tiddlers to store the following information:
var Tiddler = require("./Tiddler.js").Tiddler,
Renderer = require("./Renderer.js").Renderer,
Dependencies = require("./Dependencies.js").Dependencies,
utils = require("./Utils.js");
/* Creates a new WikiStore object
@ -271,9 +272,16 @@ Render a tiddler to a particular MIME type
title: title of the tiddler to render
template: optional title of the tiddler to use as a template
*/
WikiStore.prototype.renderTiddler = function(targetType,title,templateTitle) {
var r = new Renderer(title,templateTitle,this);
return r.render(targetType);
WikiStore.prototype.renderTiddler = function(targetType,tiddlerTitle,templateTitle) {
// Construct the tiddler macro
var macro = Renderer.MacroNode(
"tiddler",
{target: tiddlerTitle, template: templateTitle},
null,
new Dependencies([],[tiddlerTitle,templateTitle]),
this);
macro.execute();
return macro.render(targetType);
};
WikiStore.prototype.installMacro = function(macro) {