##// END OF EJS Templates
Add extra_class arg to the rest of the append methods,...
Jonathan Frederic -
Show More
@@ -403,7 +403,7 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 this.append_mime_type(json, toinsert, 'output_pyout');
407 407 this._safe_append(toinsert);
408 408 // If we just output latex, typeset it.
409 409 if ((json['text/latex'] !== undefined) || (json['text/html'] !== undefined)) {
@@ -498,11 +498,11 b' var IPython = (function (IPython) {'
498 498 } else {
499 499 // don't display if we don't know how to sanitize it
500 500 console.log("Ignoring untrusted " + type + " output.");
501 continue;
501 continue;
502 502 }
503 503 }
504 504 var md = json.metadata || {};
505 var toinsert = append.apply(this, [value, md, element]);
505 var toinsert = append.apply(this, [value, md, element, extra_class]);
506 506 $([IPython.events]).trigger('output_appended.OutputArea', [type, value, md, toinsert]);
507 507 return true;
508 508 }
@@ -511,9 +511,12 b' var IPython = (function (IPython) {'
511 511 };
512 512
513 513
514 OutputArea.prototype.append_html = function (html, md, element) {
514 OutputArea.prototype.append_html = function (html, md, element, extra_class) {
515 515 var type = 'text/html';
516 516 var toinsert = this.create_output_subarea(md, "output_html rendered_html", type);
517 if (extra_class){
518 toinsert.addClass(extra_class);
519 }
517 520 IPython.keyboard_manager.register_events(toinsert);
518 521 toinsert.append(html);
519 522 element.append(toinsert);
@@ -521,10 +524,13 b' var IPython = (function (IPython) {'
521 524 };
522 525
523 526
524 OutputArea.prototype.append_javascript = function (js, md, element) {
527 OutputArea.prototype.append_javascript = function (js, md, element, extra_class) {
525 528 // We just eval the JS code, element appears in the local scope.
526 529 var type = 'application/javascript';
527 530 var toinsert = this.create_output_subarea(md, "output_javascript", type);
531 if (extra_class){
532 toinsert.addClass(extra_class);
533 }
528 534 IPython.keyboard_manager.register_events(toinsert);
529 535 element.append(toinsert);
530 536 // FIXME TODO : remove `container element for 3.0`
@@ -560,9 +566,12 b' var IPython = (function (IPython) {'
560 566 };
561 567
562 568
563 OutputArea.prototype.append_svg = function (svg, md, element) {
569 OutputArea.prototype.append_svg = function (svg, md, element, extra_class) {
564 570 var type = 'image/svg+xml';
565 571 var toinsert = this.create_output_subarea(md, "output_svg", type);
572 if (extra_class){
573 toinsert.addClass(extra_class);
574 }
566 575 toinsert.append(svg);
567 576 element.append(toinsert);
568 577 return toinsert;
@@ -613,9 +622,12 b' var IPython = (function (IPython) {'
613 622 };
614 623
615 624
616 OutputArea.prototype.append_jpeg = function (jpeg, md, element) {
625 OutputArea.prototype.append_jpeg = function (jpeg, md, element, extra_class) {
617 626 var type = 'image/jpeg';
618 627 var toinsert = this.create_output_subarea(md, "output_jpeg", type);
628 if (extra_class){
629 toinsert.addClass(extra_class);
630 }
619 631 var img = $("<img/>").attr('src','data:image/jpeg;base64,'+jpeg);
620 632 set_width_height(img, md, 'image/jpeg');
621 633 this._dblclick_to_reset_size(img);
@@ -625,9 +637,12 b' var IPython = (function (IPython) {'
625 637 };
626 638
627 639
628 OutputArea.prototype.append_pdf = function (pdf, md, element) {
640 OutputArea.prototype.append_pdf = function (pdf, md, element, extra_class) {
629 641 var type = 'application/pdf';
630 642 var toinsert = this.create_output_subarea(md, "output_pdf", type);
643 if (extra_class){
644 toinsert.addClass(extra_class);
645 }
631 646 var a = $('<a/>').attr('href', 'data:application/pdf;base64,'+pdf);
632 647 a.attr('target', '_blank');
633 648 a.text('View PDF')
@@ -636,11 +651,14 b' var IPython = (function (IPython) {'
636 651 return toinsert;
637 652 }
638 653
639 OutputArea.prototype.append_latex = function (latex, md, element) {
654 OutputArea.prototype.append_latex = function (latex, md, element, extra_class) {
640 655 // This method cannot do the typesetting because the latex first has to
641 656 // be on the page.
642 657 var type = 'text/latex';
643 658 var toinsert = this.create_output_subarea(md, "output_latex", type);
659 if (extra_class){
660 toinsert.addClass(extra_class);
661 }
644 662 toinsert.append(latex);
645 663 element.append(toinsert);
646 664 return toinsert;
General Comments 0
You need to be logged in to leave comments. Login now