1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Added Recipe support for the tiddler marker "pluginmodule"

This allows TW5 to output new-style plugin modules for the upcoming
rewrite
This commit is contained in:
Jeremy Ruston 2012-04-30 09:32:52 +01:00
parent e09228450c
commit e9e211e51d

View File

@ -359,6 +359,7 @@ Recipe.tiddlerOutputMapper = {
shadow: "shadow",
title: "title",
jsmodule: "jsmodule",
pluginmodule: "pluginmodule",
base64ie: "base64ie"
};
@ -423,6 +424,18 @@ Recipe.tiddlerOutputter = {
out.push("</" + "script>");
}
},
pluginmodule: function(out,tiddlers) {
// plugin modules are output as a special script tag
for(var t=0; t<tiddlers.length; t++) {
var title = tiddlers[t],
tid = this.store.getTiddler(title);
out.push("<" + "script type=\"text/javascript\" data-tiddler-title=\"" + title + "\">");
out.push("$tw.defineModule(\"" + title + "\",\"" + tid.module + "\",function(module,exports,require) {");
out.push(tid.text);
out.push("});");
out.push("</" + "script>");
}
},
base64ie: function(out,tiddlers) {
// For IE, we output binary tiddlers in MHTML format (http://www.phpied.com/mhtml-when-you-need-data-uris-in-ie7-and-under/)
if(tiddlers.length) {