Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed html escaping problem.

  • Loading branch information...
commit 0087a955b667799d22c0ba4182f03aae4574ca50 1 parent 583f7ee
@zk authored
View
4 app/views/examples/_example.html.erb
@@ -17,8 +17,8 @@
<div class="clear"></div>
<div class="content">
<pre class="brush: clojure"><%= e.body.gsub("<pre>", "").
- gsub("</pre>", "") %></pre>
+ gsub("</pre>", "").gsub("<", "&lt;").gsub(">", "&gt;") %></pre>
</div>
- <div class="hidden plain_content"><%= e.body %></div>
+ <div class="hidden plain_content"><%= e.body.gsub("<", "&lt;").gsub(">", "&gt;") %></div>
<div class="clear"></div>
</div>
View
4 public/javascripts/cd.js
@@ -128,7 +128,7 @@ CD.Examples = function() {
var textarea = el.find("textarea")
function updatePreview() {
- preview.html("<pre class='brush: clojure'>" + textarea.val() + "</pre>")
+ preview.html("<pre class='brush: clojure'>" + textarea.val().replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</pre>")
SyntaxHighlighter.highlight(preview)
}
@@ -157,7 +157,7 @@ CD.Examples = function() {
example.find(".cancel").click(function(e) {
example.slideUp(function() {
- example.find(".content").html("<pre class='brush: clojure'>" + plain_content + "</pre>")
+ example.find(".content").html("<pre class='brush: clojure'>" + plain_content.replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</pre>")
example.find(".edit").css('display', 'inline')
example.removeClass("editing")
SyntaxHighlighter.highlight(example)
Please sign in to comment.
Something went wrong with that request. Please try again.