haml/haml — pull request #767 by johnkchow (2014-04-09 21:30:27+00:00)
Title: Added :sanitize_javascript template option

In production code we had experienced XSS issue when we bootstrap JS data within haml. An example is if we have the following code for a `.html.haml` file:

```haml
- user_input = ""
:javascript
var userInput = #{user_input.to_json};
```

While you could argue that the server-side code should be sanitizing data, I think this PR will add another safeguard and help a lot of folks.

I realize that this isn't a proper PR, since I'm missing a lot of things (updates to CHANGELOG, unit tests, etc). I wanted to open this PR to start a discussion to get your feedback and make any adjustments if you guys think it's a good idea. I'll go ahead and polish up the PR to get it checked in.

I'm also having trouble running the `test/filters_test.rb` tests (`bundle exec ruby -Itest test/filters_test.rb`), it just say I'm running 0 assertions. Executing `bundle exec rake` doesn't seem to be executing any of the test cases within `test/filters_test.rb`. So any help with that would be great!