mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +00:00
Added support for compiling and rendering raw text blocks
This commit is contained in:
parent
4c19c76461
commit
0910ada5fb
@ -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
|
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
|
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
|
as the context. This option is used to render a tiddler through a template eg
|
||||||
|
Loading…
Reference in New Issue
Block a user