diff --git a/CHANGELOG.md b/CHANGELOG.md index 50d7dac8..9690c16e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - right-click doesn't modify current selection when `mod` or `shift` is pressed - formulas - added `extend(x, y)` function for merging two objects + - objects' closing brackets (`}`) don't need to be escaped with a backslash anymore ## 0.37.4 diff --git a/resources/docs/extras/advanced-property-syntax.md b/resources/docs/extras/advanced-property-syntax.md index e459c4d8..fba34e40 100644 --- a/resources/docs/extras/advanced-property-syntax.md +++ b/resources/docs/extras/advanced-property-syntax.md @@ -76,7 +76,6 @@ Where FORMULA is a valid [MathJS](http://mathjs.org/docs/expressions/syntax.html - property inheritance calls (`@{...}`) are always resolved before formulas - arrays / matrices indexes are **zero-based** (ie `["a","b"][0]` returns `"a"`) - strings can be multiline when enclosed in backticks instead of double quotes (``` ` ` ```) -- inner closing brackets (`}`) must be escaped with a backslash (`\}`) except for `@{}` and `OSC{}` calls which are always resolved before formulas Additionnal functions: diff --git a/src/browser/js/app/widgets/common/widget.js b/src/browser/js/app/widgets/common/widget.js index 53c3fe6d..b8658072 100644 --- a/src/browser/js/app/widgets/common/widget.js +++ b/src/browser/js/app/widgets/common/widget.js @@ -456,9 +456,10 @@ class Widget extends EventEmitter { }) try { - propValue = propValue.replace(/#\{(?:[^}\\]|\\.)+\}/g, (m)=>{ + propValue = propValue.replace(/#\{(?:[^{}]|\{[^{}]*\})*\}/g, (m)=>{ + // one bracket nesting allowed, if we need two: #\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\} - // unescape brackets + // unescape brackets (not needed anymore, just here for backward compatibility) m = m.replace(/\\(\{|\})/g, '$1') // espace multiline strings