diff --git a/umap/static/umap/js/umap.core.js b/umap/static/umap/js/umap.core.js index 826c838b..f359c9a1 100644 --- a/umap/static/umap/js/umap.core.js +++ b/umap/static/umap/js/umap.core.js @@ -174,7 +174,7 @@ L.Util.greedyTemplate = (str, data, ignore) => { } return str.replace( - /\{ *([\w_\:\.\|]+)(?:\|("[^"]*"))? *\}/g, + /\{ *([\w_\:\.\|@]+)(?:\|("[^"]*"))? *\}/g, (str, key, staticFallback) => { const vars = key.split('|') let value diff --git a/umap/static/umap/test/Util.js b/umap/static/umap/test/Util.js index d9555430..45800e98 100644 --- a/umap/static/umap/test/Util.js +++ b/umap/static/umap/test/Util.js @@ -236,6 +236,15 @@ describe('L.Util', function () { ) }) + it('should accept arobase', function () { + assert.equal( + L.Util.greedyTemplate('A phrase with a {@variable}.', { + '@variable': 'value', + }), + 'A phrase with a value.' + ) + }) + it('should replace even with ignore if key is found', function () { assert.equal( L.Util.greedyTemplate(