Allow images in augmentStacktraceInOutput
This commit is contained in:
@ -652,12 +652,17 @@ var CodeOceanEditor = {
|
|||||||
|
|
||||||
let matches;
|
let matches;
|
||||||
|
|
||||||
let augmented_text = text;
|
// Switch both lines below to enable the output of images and render <IMG/> tags.
|
||||||
|
// Also consider `printOutput` in evaluation.js
|
||||||
|
|
||||||
|
// let augmented_text = element.text();
|
||||||
|
let augmented_text = element.html();
|
||||||
while (matches = this.tracepositions_regex.exec(text)) {
|
while (matches = this.tracepositions_regex.exec(text)) {
|
||||||
const frame = $('div.frame[data-filename="' + matches[1] + '"]')
|
const frame = $('div.frame[data-filename="' + matches[1] + '"]')
|
||||||
|
|
||||||
if (frame.length > 0) {
|
if (frame.length > 0) {
|
||||||
augmented_text = augmented_text.replace(new RegExp(matches[0], 'g'), "<a href='#' data-file='" + matches[1] + "' data-line='" + matches[2] + "'>" + matches[0] + "</a>");
|
// augmented_text = augmented_text.replace(new RegExp(matches[0], 'g'), "<a href='#' data-file='" + matches[1] + "' data-line='" + matches[2] + "'>" + matches[0] + "</a>");
|
||||||
|
augmented_text = augmented_text.replace(new RegExp(_.unescape(matches[0]), 'g'), "<a href='#' data-file='" + matches[1] + "' data-line='" + matches[2] + "'>" + matches[0] + "</a>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
element.html(augmented_text);
|
element.html(augmented_text);
|
||||||
|
@ -212,7 +212,8 @@ CodeOceanEditorEvaluation = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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.
|
||||||
|
// Also consider `augmentStacktraceInOutput` in editor.js.erb
|
||||||
if (!colorize) {
|
if (!colorize) {
|
||||||
if (output.stdout !== undefined && output.stdout !== '') {
|
if (output.stdout !== undefined && output.stdout !== '') {
|
||||||
output.stdout = output.stdout.replace(this.nonPrintableRegEx, "")
|
output.stdout = output.stdout.replace(this.nonPrintableRegEx, "")
|
||||||
|
Reference in New Issue
Block a user