Tighten up parsing of if-statement in default template

Require space after if and an ending %} after the condition.
This commit is contained in:
Erik Flodin 2021-01-10 20:53:12 +01:00
parent a5b1067e02
commit e2ed647c2a
No known key found for this signature in database
GPG Key ID: 420A7C865EE3F85F
1 changed files with 2 additions and 2 deletions

4
yadm
View File

@ -413,13 +413,13 @@ function replace_vars() {
}
}
function conditions() {
pattern = ifs blank "*("
pattern = ifs blank "+("
for (label in c) {
value = c[label]
gsub(/[\\.^$(){}\[\]|*+?]/, "\\\\&", value)
pattern = sprintf("%syadm\\.%s" blank "*==" blank "*\"%s\"|", pattern, label, value)
}
sub(/\|$/,")",pattern)
sub(/\|$/, ")" blank "*%}$", pattern)
return pattern
}
EOF