Merging in escaping for Underscore templates, using <%- syntax. Sorry Eco.

This commit is contained in:
Jeremy Ashkenas
2011-10-05 16:19:00 -04:00
parent b501ba49e9
commit cc6a9d494d
2 changed files with 7 additions and 3 deletions

View File

@@ -81,6 +81,10 @@ $(document).ready(function() {
var withNewlinesAndTabs = _.template('This\n\t\tis: <%= x %>.\n\tok.\nend.');
equals(withNewlinesAndTabs({x: 'that'}), 'This\n\t\tis: that.\n\tok.\nend.');
var template = _.template("<i><%- value %></i>");
var result = template({value: "<script>"});
equals(result, '<i>&lt;script&gt;</i>');
if (!$.browser.msie) {
var fromHTML = _.template($('#template').html());
equals(fromHTML({data : 12345}).replace(/\s/g, ''), '<li>24690</li>');