ljosa/urlize.js — pull request #9 by marioizquierdo (2012-11-21 20:54:53+00:00)
Title: Escape slashes

### What

Add support for slash.

* When auto_escape is true, then replace "/" with "/"
* The `simple_url_re` RegExp will now recognize "http://" as a URL. This allows to urlize a text that was escaped by other library before (it should be the common case IMO)

### Why

I am using urlize.js with haml_coffee_assets templates. A week ago it suddenly stopped working. I finally found it was because an update in their library: https://github.com/netzpirat/haml_coffee_assets/commit/1894b0544622b7ac33955aa21a1161748780bd98

At first I though of complaining in there or modifying the HAML.escape function in my project, but hell, they are right: OWASP suggests you escape it per https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet (see RULE#1).

So, I decided to add support for slash escape in this library instead. Now it works fine.

### Also: Comment broken specs as pending

I found the following test broken in master: "IDN" and "Colon before".
Is not part of this pull request to fix them, but it was confusing to me to see them broken (it took me a little while to realize they were actually broken before my changes), they should be marked as pending (commented out) while they are not fixed. There should never be no red tests in master.

### Also: Correct indentation

I found the code to be indented half with tabs, half with spaces, sometimes with 4 spaces, sometimes with 2 spaces. And sometimes there was a weird "FF" character (not visible in most editors, also not visible here in github. I found it with SublimeText2)