From 3da810b2b3669157c96fcbb045ab405e91738f1f Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Tue, 29 May 2012 22:01:35 +0100 Subject: [PATCH] Extended wiki.serializeTiddler to take a Tiddler() object as well as a title --- core/modules/wiki.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 0a656fb4b..6a2e6713e 100644 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -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 {