diff --git a/js/WikiStore.js b/js/WikiStore.js index 8bc926f64..6552c697c 100755 --- a/js/WikiStore.js +++ b/js/WikiStore.js @@ -201,6 +201,15 @@ WikiStore.prototype.parseTiddler = function(title) { } }; +/* +Compiles a block of text of a specified type into a JavaScript function that renders the text in a particular MIME type +*/ +WikiStore.prototype.compileText = function(type,text,targetType) { + /*jslint evil: true */ + var tree = this.parseText(type,text); + return eval(tree.compile(targetType)); +}; + /* Compiles a JavaScript function that renders a tiddler in a particular MIME type */ @@ -218,6 +227,15 @@ WikiStore.prototype.compileTiddler = function(title,type) { } }; +/* +Render a block of text of a specified type into a particular MIME type +*/ +WikiStore.prototype.renderText = function(type,text,targetType,asTitle) { + var tiddler = this.getTiddler(asTitle), + fn = this.compileText(type,text,targetType); + return fn(tiddler,this,utils); +}; + /* Render a tiddler to a particular MIME type. Optionally render it with a different tiddler as the context. This option is used to render a tiddler through a template eg