Created
August 27, 2013 00:51
-
-
Save atheken/6348491 to your computer and use it in GitHub Desktop.
When you pre-compile your jade templates for the browser, interpolated locals will still require jade.escape, but it's a simple fix, and here it is!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is required in order to properly escape | |
// jade interpolation | |
jade = { | |
escape: function(html){ | |
return String(html) | |
.replace(/&/g, '&') | |
.replace(/</g, '<') | |
.replace(/>/g, '>') | |
.replace(/"/g, '"'); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment