Skip to content

Commit

Permalink
fix(compiler): fix interpolation regexp
Browse files Browse the repository at this point in the history
- Fix the interpolation regexp to match newline characters (i.e. `\n` and `\r`)

Closes #6056
  • Loading branch information
wesleycho authored and alexeagle committed Feb 3, 2016
1 parent 995a9e0 commit 9b0e10e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {

var _implicitReceiver = new ImplicitReceiver();
// TODO(tbosch): Cannot make this const/final right now because of the transpiler...
var INTERPOLATION_REGEXP = /\{\{(.*?)\}\}/g;
var INTERPOLATION_REGEXP = /\{\{([\s\S]*?)\}\}/g;

class ParseException extends BaseException {
constructor(message: string, input: string, errLocation: string, ctxLocation?: any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ export function main() {

it('should parse conditional expression',
() => { checkInterpolation('{{ a < b ? a : b }}'); });

it('should parse expression with newline characters', () => {
checkInterpolation(`{{ 'foo' +\n 'bar' +\r 'baz' }}`, `{{ "foo" + "bar" + "baz" }}`);
});
});

describe("parseSimpleBinding", () => {
Expand Down

0 comments on commit 9b0e10e

Please sign in to comment.