prop maths: allow escaping brackets in math expressions

This commit is contained in:
jean-emmanuel 2018-02-12 15:40:51 +01:00
parent 36cc729f5f
commit 946e144ddf

View file

@ -288,7 +288,9 @@ class Widget extends EventEmitter {
})
try {
propValue = propValue.replace(/#\{([^\}]+)\}/g, (m)=>{
propValue = propValue.replace(/#\{(?:[^\}\\]|\\.)+\}/g, (m)=>{
m = m.replace(/\\(\{|\})/g, '$1')
if (!this.parsers[m]) this.parsers[m] = math.compile(m.substr(2, m.length - 3).trim())
let r = this.parsers[m].eval(variables)