parent
1be7950237
commit
56586125a4
2 changed files with 10 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue