Show More
@@ -425,7 +425,10 b' var IPython = (function (IPython) {' | |||||
425 | } |
|
425 | } | |
426 | s = s + '\n'; |
|
426 | s = s + '\n'; | |
427 | var toinsert = this.create_output_area(); |
|
427 | var toinsert = this.create_output_area(); | |
428 | this.append_text(s, {}, toinsert).addClass('output_pyerr'); |
|
428 | var append_text = OutputArea.append_map['text/plain']; | |
|
429 | if (append_text) { | |||
|
430 | append_text.apply(this, [s, {}, toinsert]).addClass('output_pyerr'); | |||
|
431 | } | |||
429 | this._safe_append(toinsert); |
|
432 | this._safe_append(toinsert); | |
430 | } |
|
433 | } | |
431 | }; |
|
434 | }; | |
@@ -434,7 +437,7 b' var IPython = (function (IPython) {' | |||||
434 | OutputArea.prototype.append_stream = function (json) { |
|
437 | OutputArea.prototype.append_stream = function (json) { | |
435 | // temporary fix: if stream undefined (json file written prior to this patch), |
|
438 | // temporary fix: if stream undefined (json file written prior to this patch), | |
436 | // default to most likely stdout: |
|
439 | // default to most likely stdout: | |
437 | if (json.stream == undefined){ |
|
440 | if (json.stream === undefined){ | |
438 | json.stream = 'stdout'; |
|
441 | json.stream = 'stdout'; | |
439 | } |
|
442 | } | |
440 | var text = json.text; |
|
443 | var text = json.text; | |
@@ -464,7 +467,10 b' var IPython = (function (IPython) {' | |||||
464 |
|
467 | |||
465 | // If we got here, attach a new div |
|
468 | // If we got here, attach a new div | |
466 | var toinsert = this.create_output_area(); |
|
469 | var toinsert = this.create_output_area(); | |
467 | this.append_text(text, {}, toinsert).addClass("output_stream "+subclass); |
|
470 | var append_text = OutputArea.append_map['text/plain']; | |
|
471 | if (append_text) { | |||
|
472 | append_text.apply(this, [text, {}, toinsert]).addClass("output_stream " + subclass); | |||
|
473 | } | |||
468 | this._safe_append(toinsert); |
|
474 | this._safe_append(toinsert); | |
469 | }; |
|
475 | }; | |
470 |
|
476 | |||
@@ -514,7 +520,7 b' var IPython = (function (IPython) {' | |||||
514 | }; |
|
520 | }; | |
515 |
|
521 | |||
516 |
|
522 | |||
517 |
|
|
523 | var append_html = function (html, md, element) { | |
518 | var type = 'text/html'; |
|
524 | var type = 'text/html'; | |
519 | var toinsert = this.create_output_subarea(md, "output_html rendered_html", type); |
|
525 | var toinsert = this.create_output_subarea(md, "output_html rendered_html", type); | |
520 | IPython.keyboard_manager.register_events(toinsert); |
|
526 | IPython.keyboard_manager.register_events(toinsert); | |
@@ -524,7 +530,7 b' var IPython = (function (IPython) {' | |||||
524 | }; |
|
530 | }; | |
525 |
|
531 | |||
526 |
|
532 | |||
527 |
|
|
533 | var append_javascript = function (js, md, element) { | |
528 | // We just eval the JS code, element appears in the local scope. |
|
534 | // We just eval the JS code, element appears in the local scope. | |
529 | var type = 'application/javascript'; |
|
535 | var type = 'application/javascript'; | |
530 | var toinsert = this.create_output_subarea(md, "output_javascript", type); |
|
536 | var toinsert = this.create_output_subarea(md, "output_javascript", type); | |
@@ -545,7 +551,7 b' var IPython = (function (IPython) {' | |||||
545 | }; |
|
551 | }; | |
546 |
|
552 | |||
547 |
|
553 | |||
548 |
|
|
554 | var append_text = function (data, md, element) { | |
549 | var type = 'text/plain'; |
|
555 | var type = 'text/plain'; | |
550 | var toinsert = this.create_output_subarea(md, "output_text", type); |
|
556 | var toinsert = this.create_output_subarea(md, "output_text", type); | |
551 | // escape ANSI & HTML specials in plaintext: |
|
557 | // escape ANSI & HTML specials in plaintext: | |
@@ -560,7 +566,7 b' var IPython = (function (IPython) {' | |||||
560 | }; |
|
566 | }; | |
561 |
|
567 | |||
562 |
|
568 | |||
563 |
|
|
569 | var append_svg = function (svg, md, element) { | |
564 | var type = 'image/svg+xml'; |
|
570 | var type = 'image/svg+xml'; | |
565 | var toinsert = this.create_output_subarea(md, "output_svg", type); |
|
571 | var toinsert = this.create_output_subarea(md, "output_svg", type); | |
566 | toinsert.append(svg); |
|
572 | toinsert.append(svg); | |
@@ -601,7 +607,7 b' var IPython = (function (IPython) {' | |||||
601 | if (width !== undefined) img.attr('width', width); |
|
607 | if (width !== undefined) img.attr('width', width); | |
602 | }; |
|
608 | }; | |
603 |
|
609 | |||
604 |
|
|
610 | var append_png = function (png, md, element) { | |
605 | var type = 'image/png'; |
|
611 | var type = 'image/png'; | |
606 | var toinsert = this.create_output_subarea(md, "output_png", type); |
|
612 | var toinsert = this.create_output_subarea(md, "output_png", type); | |
607 | var img = $("<img/>").attr('src','data:image/png;base64,'+png); |
|
613 | var img = $("<img/>").attr('src','data:image/png;base64,'+png); | |
@@ -613,7 +619,7 b' var IPython = (function (IPython) {' | |||||
613 | }; |
|
619 | }; | |
614 |
|
620 | |||
615 |
|
621 | |||
616 |
|
|
622 | var append_jpeg = function (jpeg, md, element) { | |
617 | var type = 'image/jpeg'; |
|
623 | var type = 'image/jpeg'; | |
618 | var toinsert = this.create_output_subarea(md, "output_jpeg", type); |
|
624 | var toinsert = this.create_output_subarea(md, "output_jpeg", type); | |
619 | var img = $("<img/>").attr('src','data:image/jpeg;base64,'+jpeg); |
|
625 | var img = $("<img/>").attr('src','data:image/jpeg;base64,'+jpeg); | |
@@ -625,7 +631,7 b' var IPython = (function (IPython) {' | |||||
625 | }; |
|
631 | }; | |
626 |
|
632 | |||
627 |
|
633 | |||
628 |
|
|
634 | var append_pdf = function (pdf, md, element) { | |
629 | var type = 'application/pdf'; |
|
635 | var type = 'application/pdf'; | |
630 | var toinsert = this.create_output_subarea(md, "output_pdf", type); |
|
636 | var toinsert = this.create_output_subarea(md, "output_pdf", type); | |
631 | var a = $('<a/>').attr('href', 'data:application/pdf;base64,'+pdf); |
|
637 | var a = $('<a/>').attr('href', 'data:application/pdf;base64,'+pdf); | |
@@ -636,7 +642,7 b' var IPython = (function (IPython) {' | |||||
636 | return toinsert; |
|
642 | return toinsert; | |
637 | } |
|
643 | } | |
638 |
|
644 | |||
639 |
|
|
645 | var append_latex = function (latex, md, element) { | |
640 | // This method cannot do the typesetting because the latex first has to |
|
646 | // This method cannot do the typesetting because the latex first has to | |
641 | // be on the page. |
|
647 | // be on the page. | |
642 | var type = 'text/latex'; |
|
648 | var type = 'text/latex'; | |
@@ -851,14 +857,14 b' var IPython = (function (IPython) {' | |||||
851 | ]; |
|
857 | ]; | |
852 |
|
858 | |||
853 | OutputArea.append_map = { |
|
859 | OutputArea.append_map = { | |
854 |
"text/plain" : |
|
860 | "text/plain" : append_text, | |
855 |
"text/html" : |
|
861 | "text/html" : append_html, | |
856 |
"image/svg+xml" : |
|
862 | "image/svg+xml" : append_svg, | |
857 |
"image/png" : |
|
863 | "image/png" : append_png, | |
858 |
"image/jpeg" : |
|
864 | "image/jpeg" : append_jpeg, | |
859 |
"text/latex" : |
|
865 | "text/latex" : append_latex, | |
860 |
"application/javascript" : |
|
866 | "application/javascript" : append_javascript, | |
861 |
"application/pdf" : |
|
867 | "application/pdf" : append_pdf | |
862 | }; |
|
868 | }; | |
863 |
|
869 | |||
864 | IPython.OutputArea = OutputArea; |
|
870 | IPython.OutputArea = OutputArea; |
General Comments 0
You need to be logged in to leave comments.
Login now