1
0
Fork 0
mirror of synced 2024-11-04 09:08:56 -05:00

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

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