Show More
@@ -252,8 +252,7 var IPython = (function (IPython) { | |||||
252 | json.evalue = content.evalue; |
|
252 | json.evalue = content.evalue; | |
253 | json.traceback = content.traceback; |
|
253 | json.traceback = content.traceback; | |
254 | } |
|
254 | } | |
255 | // append with dynamic=true |
|
255 | this.append_output(json); | |
256 | this.append_output(json, true); |
|
|||
257 | }; |
|
256 | }; | |
258 |
|
257 | |||
259 | OutputArea.mime_map = { |
|
258 | OutputArea.mime_map = { | |
@@ -288,8 +287,7 var IPython = (function (IPython) { | |||||
288 | }; |
|
287 | }; | |
289 |
|
288 | |||
290 |
|
289 | |||
291 |
OutputArea.prototype.append_output = function (json |
|
290 | OutputArea.prototype.append_output = function (json) { | |
292 | // If dynamic is true, javascript output will be eval'd. |
|
|||
293 | this.expand(); |
|
291 | this.expand(); | |
294 | // Clear the output if clear is queued. |
|
292 | // Clear the output if clear is queued. | |
295 | var needs_height_reset = false; |
|
293 | var needs_height_reset = false; | |
@@ -299,11 +297,11 var IPython = (function (IPython) { | |||||
299 | } |
|
297 | } | |
300 |
|
298 | |||
301 | if (json.output_type === 'pyout') { |
|
299 | if (json.output_type === 'pyout') { | |
302 |
this.append_pyout(json |
|
300 | this.append_pyout(json); | |
303 | } else if (json.output_type === 'pyerr') { |
|
301 | } else if (json.output_type === 'pyerr') { | |
304 | this.append_pyerr(json); |
|
302 | this.append_pyerr(json); | |
305 | } else if (json.output_type === 'display_data') { |
|
303 | } else if (json.output_type === 'display_data') { | |
306 |
this.append_display_data(json |
|
304 | this.append_display_data(json); | |
307 | } else if (json.output_type === 'stream') { |
|
305 | } else if (json.output_type === 'stream') { | |
308 | this.append_stream(json); |
|
306 | this.append_stream(json); | |
309 | } |
|
307 | } | |
@@ -414,13 +412,13 var IPython = (function (IPython) { | |||||
414 | }; |
|
412 | }; | |
415 |
|
413 | |||
416 |
|
414 | |||
417 |
OutputArea.prototype.append_pyout = function (json |
|
415 | OutputArea.prototype.append_pyout = function (json) { | |
418 | var n = json.prompt_number || ' '; |
|
416 | var n = json.prompt_number || ' '; | |
419 | var toinsert = this.create_output_area(); |
|
417 | var toinsert = this.create_output_area(); | |
420 | if (this.prompt_area) { |
|
418 | if (this.prompt_area) { | |
421 | toinsert.find('div.prompt').addClass('output_prompt').html('Out[' + n + ']:'); |
|
419 | toinsert.find('div.prompt').addClass('output_prompt').html('Out[' + n + ']:'); | |
422 | } |
|
420 | } | |
423 |
this.append_mime_type(json, toinsert |
|
421 | this.append_mime_type(json, toinsert); | |
424 | this._safe_append(toinsert); |
|
422 | this._safe_append(toinsert); | |
425 | // If we just output latex, typeset it. |
|
423 | // If we just output latex, typeset it. | |
426 | if ((json.latex !== undefined) || (json.html !== undefined)) { |
|
424 | if ((json.latex !== undefined) || (json.html !== undefined)) { | |
@@ -481,9 +479,9 var IPython = (function (IPython) { | |||||
481 | }; |
|
479 | }; | |
482 |
|
480 | |||
483 |
|
481 | |||
484 |
OutputArea.prototype.append_display_data = function (json |
|
482 | OutputArea.prototype.append_display_data = function (json) { | |
485 | var toinsert = this.create_output_area(); |
|
483 | var toinsert = this.create_output_area(); | |
486 |
if (this.append_mime_type(json, toinsert |
|
484 | if (this.append_mime_type(json, toinsert)) { | |
487 | this._safe_append(toinsert); |
|
485 | this._safe_append(toinsert); | |
488 | // If we just output latex, typeset it. |
|
486 | // If we just output latex, typeset it. | |
489 | if ( (json.latex !== undefined) || (json.html !== undefined) ) { |
|
487 | if ( (json.latex !== undefined) || (json.html !== undefined) ) { | |
@@ -502,23 +500,16 var IPython = (function (IPython) { | |||||
502 | 'text/plain' |
|
500 | 'text/plain' | |
503 | ]; |
|
501 | ]; | |
504 |
|
502 | |||
505 |
OutputArea.prototype.append_mime_type = function (json, element |
|
503 | OutputArea.prototype.append_mime_type = function (json, element) { | |
506 |
|
504 | |||
507 | for(var type_i in OutputArea.display_order){ |
|
505 | for(var type_i in OutputArea.display_order){ | |
508 | var type = OutputArea.display_order[type_i]; |
|
506 | var type = OutputArea.display_order[type_i]; | |
509 | if(json[type] !== undefined ){ |
|
507 | if(json[type] !== undefined ){ | |
510 | md = json.metadata || {}; |
|
508 | var append = OutputArea.append_map[type]; | |
511 |
if( |
|
509 | if (append !== undefined) { | |
512 |
|
|
510 | md = json.metadata || {}; | |
513 |
|
|
511 | append.apply(this, [json[type], md, element]); | |
514 |
|
|
512 | return true; | |
515 | } |
|
|||
516 | } else { |
|
|||
517 | var append = OutputArea.append_map[type]; |
|
|||
518 | if (append !== undefined) { |
|
|||
519 | append.apply(this, [json[type], md, element]); |
|
|||
520 | return true; |
|
|||
521 | } |
|
|||
522 | } |
|
513 | } | |
523 | } |
|
514 | } | |
524 | } |
|
515 | } | |
@@ -755,6 +746,14 var IPython = (function (IPython) { | |||||
755 | // TODO: remove this when we update to nbformat 4 |
|
746 | // TODO: remove this when we update to nbformat 4 | |
756 | var len = outputs.length; |
|
747 | var len = outputs.length; | |
757 | var data; |
|
748 | var data; | |
|
749 | ||||
|
750 | // We don't want to display javascript on load, so remove it from the | |||
|
751 | // display order for the duration of this function call, but be sure to | |||
|
752 | // put it back in there so incoming messages that contain javascript | |||
|
753 | // representations get displayed | |||
|
754 | var js_index = OutputArea.display_order.indexOf('application/javascript'); | |||
|
755 | OutputArea.display_order.splice(js_index, 1); | |||
|
756 | ||||
758 | for (var i=0; i<len; i++) { |
|
757 | for (var i=0; i<len; i++) { | |
759 | data = outputs[i]; |
|
758 | data = outputs[i]; | |
760 | var msg_type = data.output_type; |
|
759 | var msg_type = data.output_type; | |
@@ -764,9 +763,11 var IPython = (function (IPython) { | |||||
764 | data.metadata = this.rename_keys(data.metadata, OutputArea.mime_map_r); |
|
763 | data.metadata = this.rename_keys(data.metadata, OutputArea.mime_map_r); | |
765 | } |
|
764 | } | |
766 |
|
765 | |||
767 | // append with dynamic=false. |
|
766 | this.append_output(data); | |
768 | this.append_output(data, false); |
|
|||
769 | } |
|
767 | } | |
|
768 | ||||
|
769 | // reinsert javascript into display order, see note above | |||
|
770 | OutputArea.display_order.splice(js_index, 0, 'application/javascript'); | |||
770 | }; |
|
771 | }; | |
771 |
|
772 | |||
772 |
|
773 |
General Comments 0
You need to be logged in to leave comments.
Login now