mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-30 12:11:32 +08:00
Finishing display system work.
* Added image/jpeg MIME type to notebook format, the core display logic and the notebook. * Finished HTML, SVG, Image, Math, Javascript, JSON classes.
This commit is contained in:
parent
3ad866c73d
commit
0db7ab16a3
@ -205,13 +205,15 @@ var IPython = (function (IPython) {
|
||||
|
||||
CodeCell.prototype.append_pyerr = function (json) {
|
||||
var tb = json.traceback;
|
||||
var s = '';
|
||||
var len = tb.length;
|
||||
for (var i=0; i<len; i++) {
|
||||
s = s + tb[i] + '\n';
|
||||
}
|
||||
s = s + '\n';
|
||||
this.append_text(s);
|
||||
if (tb !== undefined) {
|
||||
var s = '';
|
||||
var len = tb.length;
|
||||
for (var i=0; i<len; i++) {
|
||||
s = s + tb[i] + '\n';
|
||||
}
|
||||
s = s + '\n';
|
||||
this.append_text(s);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -240,6 +242,8 @@ var IPython = (function (IPython) {
|
||||
this.append_svg(json.svg, element);
|
||||
} else if (json.png !== undefined) {
|
||||
this.append_png(json.png, element);
|
||||
} else if (json.jpeg !== undefined) {
|
||||
this.append_jpeg(json.jpeg, element);
|
||||
} else if (json.text !== undefined) {
|
||||
this.append_text(json.text, element);
|
||||
};
|
||||
@ -283,6 +287,15 @@ var IPython = (function (IPython) {
|
||||
};
|
||||
|
||||
|
||||
CodeCell.prototype.append_jpeg = function (jpeg, element) {
|
||||
element = element || this.element.find("div.output");
|
||||
var toinsert = $("<div/>").addClass("output_area output_jpeg");
|
||||
toinsert.append($("<img/>").attr('src','data:image/jpeg;base64,'+jpeg));
|
||||
element.append(toinsert);
|
||||
return element;
|
||||
};
|
||||
|
||||
|
||||
CodeCell.prototype.append_latex = function (latex, element) {
|
||||
// This method cannot do the typesetting because the latex first has to
|
||||
// be on the page.
|
||||
|
@ -544,6 +544,9 @@ var IPython = (function (IPython) {
|
||||
if (data['image/png'] !== undefined) {
|
||||
json.png = data['image/png'];
|
||||
};
|
||||
if (data['image/jpeg'] !== undefined) {
|
||||
json.jpeg = data['image/jpeg'];
|
||||
};
|
||||
if (data['text/latex'] !== undefined) {
|
||||
json.latex = data['text/latex'];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user