fix parsing schedule templates with brackets in the name (#5189)

This commit is contained in:
Matt Farrell
2025-06-19 04:38:17 +10:00
committed by GitHub
parent 53e3694a38
commit d821f1cebc
2 changed files with 12 additions and 6 deletions

View File

@@ -87,16 +87,16 @@ day 'day' = $(d d)
date = $(month '-' day)
currencySymbol 'currency symbol' = symbol: . & { return /\p{Sc}/u.test(symbol) }
// Match schedule name including spaces up until we see a [, looking ahead to make sure it's followed by increase/decrease
// Match schedule name including spaces and brackets, but stop before percentage modifiers
rawScheduleName = $(
(
[^ \t\r\n\[] // First character can't be space or [
!('['('increase'i/'decrease'i)) // Don't start with [increase/decrease
[^ \t\r\n] // First character can't be whitespace
(
[^\r\n\[] // Subsequent characters can include spaces but not [
/
(![^\r\n\[]* '['('increase'i/'decrease'i)) [ ] // Or spaces if not followed by [increase/decrease
!(_ '['('increase'i/'decrease'i)) // Don't match if followed by [increase/decrease modifier
[^\r\n] // Any character except newlines
)*
)
) { return text() }
) { return text().trim() }
name 'Name' = $([^\r\n\t]+) { return text() }

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [MattFaz]
---
Fix parsing of schedule names containing square brackets conflicting with increase/decrease modifiers