diff --git a/app/assets/javascripts/editor/editor.js.erb b/app/assets/javascripts/editor/editor.js.erb index 9468bd85..a49a34b7 100644 --- a/app/assets/javascripts/editor/editor.js.erb +++ b/app/assets/javascripts/editor/editor.js.erb @@ -370,7 +370,8 @@ var CodeOceanEditor = { }, initializeRegexes: function () { - this.regex_for_language.set("ace/mode/python", /File "(.+?)", line (\d+)/g); + // These RegEx are run on the HTML escaped output! + this.regex_for_language.set("ace/mode/python", /File "(.+?)", line (\d+)/g); this.regex_for_language.set("ace/mode/java", /(.*\.java):(\d+):/g); }, @@ -467,7 +468,7 @@ var CodeOceanEditor = { let errorMessagesToShow = []; result.error_messages.forEach(function (item) { if (item) { - errorMessagesToShow.push(item.replace(/\n/g, '
')) + errorMessagesToShow.push(item) } }) @@ -605,7 +606,8 @@ var CodeOceanEditor = { if (this.tracepositions_regex) { $('#output>pre').each($.proxy(function(index, element) { element = $(element) - const text = element.text(); + debugger; + const text = _.escape(element.text()); element.on("click", "a", this.jumpToSourceLine.bind(this)); let matches; diff --git a/app/assets/stylesheets/editor.css.scss b/app/assets/stylesheets/editor.css.scss index fcfa2d92..06adf57a 100644 --- a/app/assets/stylesheets/editor.css.scss +++ b/app/assets/stylesheets/editor.css.scss @@ -155,11 +155,13 @@ button i.fa-spin { .error_messages_list { list-style-type: disc; padding-inline-start: 1.25rem; + white-space: pre-wrap; } .single_error_message { list-style-type: none; padding-inline-start: 0; + white-space: pre-wrap; } .enforce-top-margin {