From bf8100201d3aedad27804c318da4e2f87af3b02a Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 5 May 2012 14:15:48 +0100 Subject: [PATCH] Added serializers required for cooking TiddlyWiki documents --- rabbithole/core/modules/serializers.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/rabbithole/core/modules/serializers.js b/rabbithole/core/modules/serializers.js index 8fe316566..b79aebf9b 100644 --- a/rabbithole/core/modules/serializers.js +++ b/rabbithole/core/modules/serializers.js @@ -21,4 +21,28 @@ exports["text/html"] = function(tiddler) { return text ? text : ""; }; +exports["application/x-tiddler-module"] = function(tiddler) { + var result = []; + result.push("<" + "script type=\"text/javascript\" data-tiddler-title=\"" + tiddler.fields.title + "\">"); + result.push("$tw.modules.define(\"" + tiddler.fields.title + "\",\"" + tiddler.fields["module-type"] + "\",function(module,exports,require) {"); + result.push(tiddler.fields.text); + result.push("});"); + result.push("\n"); + return result.join(""); +}; + +exports["application/x-tiddler-html-div"] = function(tiddler) { + var result = []; + result.push("\n
");
+	result.push($tw.utils.htmlEncode(tiddler.fields.text));
+	result.push("
\n"); + return result.join(""); +}; + })();