##// END OF EJS Templates
passthrough unrecognized output mime-types...
MinRK -
Show More
@@ -254,44 +254,26 b' var IPython = (function (IPython) {'
254 this.append_output(json, true);
254 this.append_output(json, true);
255 };
255 };
256
256
257 var mime_types = ['application/javascript', 'application/json',
257 OutputArea.mime_map = {
258 'image/jpeg', 'image/png', 'image/svg+xml', 'text/html',
258 "text/plain" : "text",
259 'text/latex', 'text/plain'];
259 "text/html" : "html",
260 "image/svg+xml" : "svg",
261 "image/png" : "png",
262 "image/jpeg" : "jpeg",
263 "text/latex" : "latex",
264 "application/json" : "json",
265 "application/javascript" : "javascript",
266 };
260
267
261 OutputArea.prototype.convert_mime_types = function (json, data) {
268 OutputArea.prototype.convert_mime_types = function (json, data) {
262 if (data === undefined) {
269 if (!data) {
263 return json;
270 return json;
264 }
271 }
265 if (data['text/plain'] !== undefined) {
266 json.text = data['text/plain'];
267 }
268 if (data['text/html'] !== undefined) {
269 json.html = data['text/html'];
270 }
271 if (data['image/svg+xml'] !== undefined) {
272 json.svg = data['image/svg+xml'];
273 }
274 if (data['image/png'] !== undefined) {
275 json.png = data['image/png'];
276 }
277 if (data['image/jpeg'] !== undefined) {
278 json.jpeg = data['image/jpeg'];
279 }
280 if (data['text/latex'] !== undefined) {
281 json.latex = data['text/latex'];
282 }
283 if (data['application/json'] !== undefined) {
284 json.json = data['application/json'];
285 }
286 if (data['application/javascript'] !== undefined) {
287 json.javascript = data['application/javascript'];
288 }
289 // non-mimetype-keyed metadata used to get dropped here, this code
272 // non-mimetype-keyed metadata used to get dropped here, this code
290 // re-injects it into the json.
273 // re-injects it into the json.
291 for (x in data){
274 for (var key in data) {
292 if( !(x in mime_types) ) {
275 var json_key = OutputArea.mime_map[key] || key;
293 json[x] = data[x];
276 json[json_key] = data[key];
294 }
295 }
277 }
296 return json;
278 return json;
297 };
279 };
General Comments 0
You need to be logged in to leave comments. Login now