Skip to content

Commit

Permalink
escape all reserved chars
Browse files Browse the repository at this point in the history
  • Loading branch information
aeosynth committed Feb 11, 2011
1 parent 626b092 commit 49aed8e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/ck.coffee
Expand Up @@ -68,9 +68,13 @@ scope =
html += "#{indent}#{doctypes[key]}"
return
esc: (str) ->
str
.replace(/&/g, '&')
.replace(/</g, '&lt;')
str.replace /[&<>"']/g, (c) ->
switch c
when '&' then '&amp;'
when '<' then '&lt;'
when '>' then '&gt;'
when '"' then '&quot;'
when "'" then '&#39;'
ie: (expr, arg) ->
html += "#{newline}#{indent}<!--[if #{expr}]>"
nest arg
Expand Down

0 comments on commit 49aed8e

Please sign in to comment.