Skip to content

Commit

Permalink
fix #547 and escape string when only JS in the live output (first ver…
Browse files Browse the repository at this point in the history
…sion was on wrong branch)
  • Loading branch information
remy committed Mar 24, 2013
1 parent dd14dfb commit 3f5cc6c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion public/js/render/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ function getPreparedCode(nojs) {
// contains '$$' it's replaced to '$' - thus breaking Prototype code. This method
// gets around the problem.
if (!hasHTML && hasJS) {
source = "<pre>\n" + js + "</pre>";
source = "<pre>\n" + js.replace(/[<>&]/g, function (m) {
if (m == '<') return '&lt;';
if (m == '>') return '&gt;';
if (m == '"') return '&quot;';
}) + "</pre>";
} else if (re.code.test(source)) {
parts = source.split('%code%');
source = parts[0] + js + parts[1];
Expand Down

0 comments on commit 3f5cc6c

Please sign in to comment.