##// END OF EJS Templates
use mime type in memory
Paul Ivanov -
Show More
@@ -264,6 +264,17 b' var IPython = (function (IPython) {'
264 "application/json" : "json",
264 "application/json" : "json",
265 "application/javascript" : "javascript",
265 "application/javascript" : "javascript",
266 };
266 };
267
268 OutputArea.mime_map_r = {
269 "text" : "text/plain",
270 "html" : "text/html",
271 "svg" : "image/svg+xml",
272 "png" : "image/png",
273 "jpeg" : "image/jpeg",
274 "latex" : "text/latex",
275 "json" : "application/json",
276 "javascript" : "application/javascript",
277 };
267
278
268 OutputArea.prototype.convert_mime_types = function (json, data) {
279 OutputArea.prototype.convert_mime_types = function (json, data) {
269 if (!data) {
280 if (!data) {
@@ -272,8 +283,8 b' var IPython = (function (IPython) {'
272 // non-mimetype-keyed metadata used to get dropped here, this code
283 // non-mimetype-keyed metadata used to get dropped here, this code
273 // re-injects it into the json.
284 // re-injects it into the json.
274 for (var key in data) {
285 for (var key in data) {
275 var json_key = OutputArea.mime_map[key] || key;
286 var rkey = OutputArea.mime_map_r[key] || key;
276 json[json_key] = data[key];
287 json[rkey] = data[key];
277 }
288 }
278 return json;
289 return json;
279 };
290 };
@@ -328,7 +339,6 b' var IPython = (function (IPython) {'
328 return mime_md[key];
339 return mime_md[key];
329 }
340 }
330 // fallback on global
341 // fallback on global
331 console.log("fallback" + key + " "+ metadata[key]);
332 return metadata[key];
342 return metadata[key];
333 }
343 }
334
344
@@ -485,7 +495,15 b' var IPython = (function (IPython) {'
485 }
495 }
486 };
496 };
487
497
488 OutputArea.display_order = ['javascript','html','latex','svg','png','jpeg','text'];
498 OutputArea.display_order = [
499 'application/javascript',
500 'text/html',
501 'text/latex',
502 'image/svg+xml',
503 'image/png',
504 'image/jpeg',
505 'text/plain'
506 ];
489
507
490 OutputArea.prototype.append_mime_type = function (json, element, dynamic) {
508 OutputArea.prototype.append_mime_type = function (json, element, dynamic) {
491
509
@@ -502,7 +520,8 b' var IPython = (function (IPython) {'
502 return true;
520 return true;
503 }
521 }
504 } else {
522 } else {
505 this['append_'+type](json[type], md, element);
523 var old_name = OutputArea.mime_map[type]
524 this['append_'+old_name](json[type], md, element, type);
506 return true;
525 return true;
507 }
526 }
508 return false;
527 return false;
General Comments 0
You need to be logged in to leave comments. Login now