diff --git a/ghost/tpl/lib/tpl.js b/ghost/tpl/lib/tpl.js index f7e811f94f..248589190c 100644 --- a/ghost/tpl/lib/tpl.js +++ b/ghost/tpl/lib/tpl.js @@ -11,7 +11,7 @@ const interpolate = /(? { if (!data) { diff --git a/ghost/tpl/test/tpl.test.js b/ghost/tpl/test/tpl.test.js index c82a39e60f..c3bf6df3b0 100644 --- a/ghost/tpl/test/tpl.test.js +++ b/ghost/tpl/test/tpl.test.js @@ -20,7 +20,7 @@ describe('tpl', function () { result.should.eql('Go visit https://example.com'); }); - it('Can handle mixing with handlebars-related messages', function () { + it('Can mix interpolation handlebars in the same message', function () { const string = '{{#get}} helper took {totalMs}ms to complete'; const data = { totalMs: '500' @@ -30,6 +30,18 @@ describe('tpl', function () { result.should.eql('{{#get}} helper took 500ms to complete'); }); + it('Can mix interpolation with handlebars-block helpers without escaping', function () { + const string = '{{#{helperName}}} helper took {totalMs}ms to complete'; + + const data = { + helperName: 'get', + totalMs: '500' + }; + + let result = tpl(string, data); + result.should.eql('{{#get}} helper took 500ms to complete'); + }); + it('Can handle escaped left braces', function () { const string = 'The \\{\\{{helperName}}} helper is not available.'; const data = {