Enable image preview in STDOUT
This commit is contained in:
@ -199,26 +199,31 @@ CodeOceanEditorEvaluation = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (output.stdout !== undefined && !output.stdout.startsWith("<img")) {
|
||||||
|
output.stdout = _.escape(output.stdout);
|
||||||
|
}
|
||||||
|
|
||||||
var element = this.findOrCreateOutputElement(index);
|
var element = this.findOrCreateOutputElement(index);
|
||||||
// Switch all four lines below to enable the output of images and render <IMG/> tags
|
// Switch all four lines below to enable the output of images and render <IMG/> tags
|
||||||
if (!colorize) {
|
if (!colorize) {
|
||||||
if (output.stdout !== undefined && output.stdout !== '') {
|
if (output.stdout !== undefined && output.stdout !== '') {
|
||||||
//element.append(output.stdout)
|
|
||||||
element.text(element.text() + output.stdout)
|
element.append(output.stdout)
|
||||||
|
//element.text(element.text() + output.stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (output.stderr !== undefined && output.stderr !== '') {
|
if (output.stderr !== undefined && output.stderr !== '') {
|
||||||
//element.append('StdErr: ' + output.stderr);
|
element.append('StdErr: ' + output.stderr);
|
||||||
element.text('StdErr: ' + element.text() + output.stderr);
|
//element.text('StdErr: ' + element.text() + output.stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (output.stderr) {
|
} else if (output.stderr) {
|
||||||
//element.addClass('text-warning').append(output.stderr);
|
element.addClass('text-warning').append(output.stderr);
|
||||||
element.addClass('text-warning').text(element.text() + output.stderr);
|
//element.addClass('text-warning').text(element.text() + output.stderr);
|
||||||
this.QaApiOutputBuffer.stderr += output.stderr;
|
this.QaApiOutputBuffer.stderr += output.stderr;
|
||||||
} else if (output.stdout) {
|
} else if (output.stdout) {
|
||||||
//element.addClass('text-success').append(output.stdout);
|
element.addClass('text-success').append(output.stdout);
|
||||||
element.addClass('text-success').text(element.text() + output.stdout);
|
//element.addClass('text-success').text(element.text() + output.stdout);
|
||||||
this.QaApiOutputBuffer.stdout += output.stdout;
|
this.QaApiOutputBuffer.stdout += output.stdout;
|
||||||
} else {
|
} else {
|
||||||
element.addClass('text-muted').text($('#output').data('message-no-output'));
|
element.addClass('text-muted').text($('#output').data('message-no-output'));
|
||||||
|
@ -84,7 +84,7 @@ class Runner::Connection::Buffer
|
|||||||
# Second, if we have the beginning of a valid command but an invalid JSON
|
# Second, if we have the beginning of a valid command but an invalid JSON
|
||||||
return true if invalid_json && message.start_with?(/\s*{"cmd/)
|
return true if invalid_json && message.start_with?(/\s*{"cmd/)
|
||||||
# Third, buffer the message if it contains long messages (e.g., an image or turtle batch commands)
|
# Third, buffer the message if it contains long messages (e.g., an image or turtle batch commands)
|
||||||
return true if invalid_json && (message.include?('<img') || message.include?('"turtlebatch"'))
|
return true if invalid_json && (message.start_with?('<img') || message.include?('"turtlebatch"'))
|
||||||
|
|
||||||
# If nothing applies, we don't want to buffer the current message
|
# If nothing applies, we don't want to buffer the current message
|
||||||
false
|
false
|
||||||
|
Reference in New Issue
Block a user