Show More
@@ -403,7 +403,10 b' var IPython = (function (IPython) {' | |||
|
403 | 403 | if (this.prompt_area) { |
|
404 | 404 | toinsert.find('div.prompt').addClass('output_prompt').text('Out[' + n + ']:'); |
|
405 | 405 | } |
|
406 |
this.append_mime_type(json, toinsert |
|
|
406 | var inserted = this.append_mime_type(json, toinsert); | |
|
407 | if (inserted) { | |
|
408 | inserted.addClass('output_pyout'); | |
|
409 | } | |
|
407 | 410 | this._safe_append(toinsert); |
|
408 | 411 | // If we just output latex, typeset it. |
|
409 | 412 | if ((json['text/latex'] !== undefined) || (json['text/html'] !== undefined)) { |
@@ -422,7 +425,7 b' var IPython = (function (IPython) {' | |||
|
422 | 425 | } |
|
423 | 426 | s = s + '\n'; |
|
424 | 427 | var toinsert = this.create_output_area(); |
|
425 |
this.append_text(s, {}, toinsert |
|
|
428 | this.append_text(s, {}, toinsert).addClass('output_pyerr'); | |
|
426 | 429 | this._safe_append(toinsert); |
|
427 | 430 | } |
|
428 | 431 | }; |
@@ -461,7 +464,7 b' var IPython = (function (IPython) {' | |||
|
461 | 464 | |
|
462 | 465 | // If we got here, attach a new div |
|
463 | 466 | var toinsert = this.create_output_area(); |
|
464 |
this.append_text(text, {}, toinsert |
|
|
467 | this.append_text(text, {}, toinsert).addClass("output_stream "+subclass); | |
|
465 | 468 | this._safe_append(toinsert); |
|
466 | 469 | }; |
|
467 | 470 | |
@@ -485,7 +488,7 b' var IPython = (function (IPython) {' | |||
|
485 | 488 | 'image/jpeg' : true |
|
486 | 489 | }; |
|
487 | 490 | |
|
488 |
OutputArea.prototype.append_mime_type = function (json, element |
|
|
491 | OutputArea.prototype.append_mime_type = function (json, element) { | |
|
489 | 492 | for (var type_i in OutputArea.display_order) { |
|
490 | 493 | var type = OutputArea.display_order[type_i]; |
|
491 | 494 | var append = OutputArea.append_map[type]; |
@@ -502,21 +505,18 b' var IPython = (function (IPython) {' | |||
|
502 | 505 | } |
|
503 | 506 | } |
|
504 | 507 | var md = json.metadata || {}; |
|
505 |
var toinsert = append.apply(this, [value, md, element |
|
|
508 | var toinsert = append.apply(this, [value, md, element]); | |
|
506 | 509 | $([IPython.events]).trigger('output_appended.OutputArea', [type, value, md, toinsert]); |
|
507 |
return t |
|
|
510 | return toinsert; | |
|
508 | 511 | } |
|
509 | 512 | } |
|
510 |
return |
|
|
513 | return null; | |
|
511 | 514 | }; |
|
512 | 515 | |
|
513 | 516 | |
|
514 |
OutputArea.prototype.append_html = function (html, md, element |
|
|
517 | OutputArea.prototype.append_html = function (html, md, element) { | |
|
515 | 518 | var type = 'text/html'; |
|
516 | 519 | var toinsert = this.create_output_subarea(md, "output_html rendered_html", type); |
|
517 | if (extra_class){ | |
|
518 | toinsert.addClass(extra_class); | |
|
519 | } | |
|
520 | 520 | IPython.keyboard_manager.register_events(toinsert); |
|
521 | 521 | toinsert.append(html); |
|
522 | 522 | element.append(toinsert); |
@@ -524,13 +524,10 b' var IPython = (function (IPython) {' | |||
|
524 | 524 | }; |
|
525 | 525 | |
|
526 | 526 | |
|
527 |
OutputArea.prototype.append_javascript = function (js, md, element |
|
|
527 | OutputArea.prototype.append_javascript = function (js, md, element) { | |
|
528 | 528 | // We just eval the JS code, element appears in the local scope. |
|
529 | 529 | var type = 'application/javascript'; |
|
530 | 530 | var toinsert = this.create_output_subarea(md, "output_javascript", type); |
|
531 | if (extra_class){ | |
|
532 | toinsert.addClass(extra_class); | |
|
533 | } | |
|
534 | 531 | IPython.keyboard_manager.register_events(toinsert); |
|
535 | 532 | element.append(toinsert); |
|
536 | 533 | // FIXME TODO : remove `container element for 3.0` |
@@ -548,16 +545,13 b' var IPython = (function (IPython) {' | |||
|
548 | 545 | }; |
|
549 | 546 | |
|
550 | 547 | |
|
551 |
OutputArea.prototype.append_text = function (data, md, element |
|
|
548 | OutputArea.prototype.append_text = function (data, md, element) { | |
|
552 | 549 | var type = 'text/plain'; |
|
553 | 550 | var toinsert = this.create_output_subarea(md, "output_text", type); |
|
554 | 551 | // escape ANSI & HTML specials in plaintext: |
|
555 | 552 | data = utils.fixConsole(data); |
|
556 | 553 | data = utils.fixCarriageReturn(data); |
|
557 | 554 | data = utils.autoLinkUrls(data); |
|
558 | if (extra_class){ | |
|
559 | toinsert.addClass(extra_class); | |
|
560 | } | |
|
561 | 555 | // The only user content injected with this HTML call is |
|
562 | 556 | // escaped by the fixConsole() method. |
|
563 | 557 | toinsert.append($("<pre/>").html(data)); |
@@ -566,12 +560,9 b' var IPython = (function (IPython) {' | |||
|
566 | 560 | }; |
|
567 | 561 | |
|
568 | 562 | |
|
569 |
OutputArea.prototype.append_svg = function (svg, md, element |
|
|
563 | OutputArea.prototype.append_svg = function (svg, md, element) { | |
|
570 | 564 | var type = 'image/svg+xml'; |
|
571 | 565 | var toinsert = this.create_output_subarea(md, "output_svg", type); |
|
572 | if (extra_class){ | |
|
573 | toinsert.addClass(extra_class); | |
|
574 | } | |
|
575 | 566 | toinsert.append(svg); |
|
576 | 567 | element.append(toinsert); |
|
577 | 568 | return toinsert; |
@@ -622,12 +613,9 b' var IPython = (function (IPython) {' | |||
|
622 | 613 | }; |
|
623 | 614 | |
|
624 | 615 | |
|
625 |
OutputArea.prototype.append_jpeg = function (jpeg, md, element |
|
|
616 | OutputArea.prototype.append_jpeg = function (jpeg, md, element) { | |
|
626 | 617 | var type = 'image/jpeg'; |
|
627 | 618 | var toinsert = this.create_output_subarea(md, "output_jpeg", type); |
|
628 | if (extra_class){ | |
|
629 | toinsert.addClass(extra_class); | |
|
630 | } | |
|
631 | 619 | var img = $("<img/>").attr('src','data:image/jpeg;base64,'+jpeg); |
|
632 | 620 | set_width_height(img, md, 'image/jpeg'); |
|
633 | 621 | this._dblclick_to_reset_size(img); |
@@ -637,12 +625,9 b' var IPython = (function (IPython) {' | |||
|
637 | 625 | }; |
|
638 | 626 | |
|
639 | 627 | |
|
640 |
OutputArea.prototype.append_pdf = function (pdf, md, element |
|
|
628 | OutputArea.prototype.append_pdf = function (pdf, md, element) { | |
|
641 | 629 | var type = 'application/pdf'; |
|
642 | 630 | var toinsert = this.create_output_subarea(md, "output_pdf", type); |
|
643 | if (extra_class){ | |
|
644 | toinsert.addClass(extra_class); | |
|
645 | } | |
|
646 | 631 | var a = $('<a/>').attr('href', 'data:application/pdf;base64,'+pdf); |
|
647 | 632 | a.attr('target', '_blank'); |
|
648 | 633 | a.text('View PDF') |
@@ -651,14 +636,11 b' var IPython = (function (IPython) {' | |||
|
651 | 636 | return toinsert; |
|
652 | 637 | } |
|
653 | 638 | |
|
654 |
OutputArea.prototype.append_latex = function (latex, md, element |
|
|
639 | OutputArea.prototype.append_latex = function (latex, md, element) { | |
|
655 | 640 | // This method cannot do the typesetting because the latex first has to |
|
656 | 641 | // be on the page. |
|
657 | 642 | var type = 'text/latex'; |
|
658 | 643 | var toinsert = this.create_output_subarea(md, "output_latex", type); |
|
659 | if (extra_class){ | |
|
660 | toinsert.addClass(extra_class); | |
|
661 | } | |
|
662 | 644 | toinsert.append(latex); |
|
663 | 645 | element.append(toinsert); |
|
664 | 646 | return toinsert; |
General Comments 0
You need to be logged in to leave comments.
Login now