1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-15 22:34:51 +00:00

Extended wiki.serializeTiddler to take a Tiddler() object as well as a title

This commit is contained in:
Jeremy Ruston 2012-05-29 22:01:35 +01:00
parent b91ccb064b
commit 3da810b2b3

View File

@ -118,9 +118,14 @@ exports.addTiddler = function(tiddler) {
this.touchTiddler(title);
};
exports.serializeTiddler = function(title,type) {
var serializer = $tw.Wiki.tiddlerSerializerPlugins[type],
tiddler = this.getTiddler(title);
/*
Serialise a tiddler to a specified text serialization format
*/
exports.serializeTiddler = function(tiddler,type) {
var serializer = $tw.Wiki.tiddlerSerializerPlugins[type];
if(typeof tiddler === "string") {
tiddler = this.getTiddler(tiddler);
}
if(serializer && tiddler) {
return serializer.call(this,tiddler);
} else {