Reuse if pattern in template_default's condition pattern
This commit is contained in:
parent
3ce59314f5
commit
4e1fb0166e
1 changed files with 2 additions and 2 deletions
4
yadm
4
yadm
|
@ -352,11 +352,11 @@ BEGIN {
|
||||||
c["user"] = user
|
c["user"] = user
|
||||||
c["distro"] = distro
|
c["distro"] = distro
|
||||||
c["source"] = source
|
c["source"] = source
|
||||||
vld = conditions()
|
|
||||||
ifs = "^{%" blank "*if"
|
ifs = "^{%" blank "*if"
|
||||||
els = "^{%" blank "*else" blank "*%}$"
|
els = "^{%" blank "*else" blank "*%}$"
|
||||||
end = "^{%" blank "*endif" blank "*%}$"
|
end = "^{%" blank "*endif" blank "*%}$"
|
||||||
skp = "^{%" blank "*(if|else|endif)"
|
skp = "^{%" blank "*(if|else|endif)"
|
||||||
|
vld = conditions()
|
||||||
inc_start = "^{%" blank "*include" blank "+\"?"
|
inc_start = "^{%" blank "*include" blank "+\"?"
|
||||||
inc_end = "\"?" blank "*%}$"
|
inc_end = "\"?" blank "*%}$"
|
||||||
inc = inc_start ".+" inc_end
|
inc = inc_start ".+" inc_end
|
||||||
|
@ -400,7 +400,7 @@ function replace_vars() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function conditions() {
|
function conditions() {
|
||||||
pattern = "^{%" blank "*if" blank "*("
|
pattern = ifs blank "*("
|
||||||
for (label in c) {
|
for (label in c) {
|
||||||
value = c[label]
|
value = c[label]
|
||||||
gsub(/[\\.^$(){}\[\]|*+?]/, "\\\\&", value)
|
gsub(/[\\.^$(){}\[\]|*+?]/, "\\\\&", value)
|
||||||
|
|
Loading…
Reference in a new issue