Parse with square brackets after a % modifier

- Fixes #1409
This commit is contained in:
dordsor21 2021-11-16 14:32:25 +00:00
parent 66357b8adb
commit 5692ec54dd
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
1 changed files with 6 additions and 2 deletions

View File

@ -114,10 +114,14 @@ public class RichPatternParser extends FaweParser<Pattern> {
chance = Expression.compile(command.substring(0, percentIndex)).evaluate();
String value = command.substring(percentIndex + 1);
if (!entry.getValue().isEmpty()) {
if (!value.isEmpty()) {
value += " ";
boolean addBrackets = !value.isEmpty();
if (addBrackets) {
value += "[";
}
value += StringMan.join(entry.getValue(), " ");
if (addBrackets) {
value += "]";
}
}
pattern = parseFromInput(value, context);
} else { // legacy block pattern