1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-28 02:50:27 +00:00

Added support for outputting tiddlers in the MHTML format accepted by older versions of IE

I don't plan for TW5 itself to run under IE6, but it's still quite
useful to be able pack base64 tiddlers in a way that IE understands
This commit is contained in:
Jeremy Ruston 2012-04-13 18:27:01 +01:00
parent 41637a791f
commit 6a7f2473db

View File

@ -358,7 +358,8 @@ Recipe.tiddlerOutputMapper = {
jquery: "javascript",
shadow: "shadow",
title: "title",
jsmodule: "jsmodule"
jsmodule: "jsmodule",
base64ie: "base64ie"
};
Recipe.compatibilityCheats = {
@ -421,6 +422,27 @@ Recipe.tiddlerOutputter = {
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) {
out.push("<!--\n");
out.push("Content-Type: multipart/related; boundary=\"_tw_mhtml" + "_tiddler\"\n");
out.push("\n");
for(var t=0; t<tiddlers.length; t++) {
var tiddler = this.store.getTiddler(tiddlers[t]);
out.push("--_tw_mhtml" + "_tiddler\n");
out.push("Content-Location:" + tiddler.title + "\n");
out.push("Content-Type:" + tiddler.type + "\n");
out.push("Content-Transfer-Encoding:base64\n");
out.push("\n");
out.push(tiddler.text);
out.push("\n\n");
}
out.push("--_tw_mhtml" + "_tiddler--\n");
out.push("\n");
out.push("-->\n");
}
}
};