From 5984be70c1225f9165b5392d73f14be3ca6b5145 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Tue, 5 Oct 2010 17:05:03 -0400 Subject: [PATCH] adding m flag to default templateSettings regexes. --- test/utility.js | 4 +++- underscore.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/utility.js b/test/utility.js index 8619440cc..94f225a80 100644 --- a/test/utility.js +++ b/test/utility.js @@ -79,7 +79,9 @@ $(document).ready(function() { var quoteTemplate = _.template("It's its, not it's"); equals(quoteTemplate({}), "It's its, not it's"); - var quoteInStatementAndBody = _.template("<% if(foo == 'bar'){ %>Statement quotes and 'quotes'.<% } %>"); + var quoteInStatementAndBody = _.template("<%\ + if(foo == 'bar'){ \ + %>Statement quotes and 'quotes'.<% } %>"); equals(quoteInStatementAndBody({foo: "bar"}), "Statement quotes and 'quotes'."); var withNewlinesAndTabs = _.template('This\n\t\tis: <%= x %>.\n\tok.\nend.'); diff --git a/underscore.js b/underscore.js index 43caa3afa..3c1d4d844 100644 --- a/underscore.js +++ b/underscore.js @@ -623,8 +623,8 @@ // By default, Underscore uses ERB-style template delimiters, change the // following template settings to use alternative delimiters. _.templateSettings = { - evaluate : /<%(.+?)%>/g, - interpolate : /<%=(.+?)%>/g + evaluate : /<%(.+?)%>/gm, + interpolate : /<%=(.+?)%>/gm }; // JavaScript templating a-la ERB, pilfered from John Resig's