ruby-ejs
ruby-ejs copied to clipboard
Allow to use a custom function to compile the escape pattern (<%- %>)
EJS.escape_function is now a formatting string. Example:
EJS.escape_function = '_.escape(%s)'
And since _.escape
and friend already take care of the string coercion https://github.com/documentcloud/underscore/blob/master/underscore.js#L1040
maybe we can let this responsibility to escape_function
.
Wow, I'd love to have this in the gem. Looks great.
+1
using a custom escape_function
really cuts down on our compiled template size. since Underscore is already available in our app just using _.escape
vs 6 inline replace
statements is a pretty quick win!