allow stdout/stderr to have distinct css

make stderr output darkred
This commit is contained in:
MinRK 2011-09-30 17:09:46 -07:00
parent a9d9a8b72c
commit 788d7e6348
2 changed files with 11 additions and 4 deletions

View File

@ -232,6 +232,9 @@ div.output_stream {
color: black;
font-family: monospace;
}
div.output_stderr {
color: darkred;
}
div.output_latex {
text-align: left;

View File

@ -256,20 +256,21 @@ var IPython = (function (IPython) {
if (json.stream == undefined){
json.stream = 'stdout';
}
var subclass = "output_"+json.stream;
if (this.outputs.length > 0){
// have at least one output to consider
var last = this.outputs[this.outputs.length-1];
if (last.output_type == 'stream' && json.stream == last.stream){
// latest output was in the same stream,
// so append directly into its pre tag
this.element.find('div.output_stream').last().find('pre').append(json.text);
this.element.find('div.'+subclass).last().find('pre').append(json.text);
return;
}
}
// If we got here, attach a new div
var toinsert = this.create_output_area();
this.append_text(json.text, toinsert);
this.append_text(json.text, toinsert, subclass);
this.element.find('div.output').append(toinsert);
};
@ -309,8 +310,11 @@ var IPython = (function (IPython) {
}
CodeCell.prototype.append_text = function (data, element) {
CodeCell.prototype.append_text = function (data, element, extra_class) {
var toinsert = $("<div/>").addClass("box_flex1 output_subarea output_stream");
if (extra_class){
toinsert.addClass(extra_class);
}
toinsert.append($("<pre/>").html(data));
element.append(toinsert);
};
@ -419,7 +423,7 @@ var IPython = (function (IPython) {
CodeCell.prototype.fromJSON = function (data) {
// console.log('Import from JSON:', data);
console.log('Import from JSON:', data);
if (data.cell_type === 'code') {
if (data.input !== undefined) {
this.set_code(data.input);