formula: better regexp (no need to escape object closing brackets)
This commit is contained in:
parent
3907721052
commit
ab0fdb85d9
3 changed files with 4 additions and 3 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue