Switched the parser to use the compiler rather than the renderer

The renderer will be going away shortly
This commit is contained in:
Jeremy Ruston 2012-01-03 11:10:25 +00:00
parent b8e7681342
commit a865c05be7
1 changed files with 11 additions and 2 deletions

View File

@ -10,6 +10,7 @@ Parses a block of tiddlywiki-format wiki text into a parse tree object.
"use strict";
var WikiTextRenderer = require("./WikiTextRenderer.js").WikiTextRenderer,
WikiTextCompiler = require("./WikiTextCompiler.js").WikiTextCompiler,
utils = require("./Utils.js"),
util = require("util");
@ -130,8 +131,16 @@ WikiTextParser.prototype.subWikifyTerm = function(output,terminatorRegExp) {
};
WikiTextParser.prototype.render = function(type,treenode,store,title) {
var renderer = new WikiTextRenderer(store,title,this);
return renderer.render(type,treenode);
var compiler = new WikiTextCompiler(store,title,this);
var code = compiler.compile(type,treenode);
var fn = eval(code);
var tiddler = store.getTiddler(title);
return fn(tiddler,store,utils);
};
WikiTextParser.prototype.compile = function(type,treenode,store,title) {
var compiler = new WikiTextCompiler(store,title,this);
return compiler.compile(type,treenode);
};
exports.WikiTextParser = WikiTextParser;