aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/lua-lupa/lupa.lua
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/lua-lupa/lupa.lua')
-rw-r--r--contrib/lua-lupa/lupa.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/contrib/lua-lupa/lupa.lua b/contrib/lua-lupa/lupa.lua
index fc49ac258..adaf419ad 100644
--- a/contrib/lua-lupa/lupa.lua
+++ b/contrib/lua-lupa/lupa.lua
@@ -1,4 +1,4 @@
--- Copyright 2015-2019 Mitchell mitchell.att.foicica.com. See LICENSE.
+-- Copyright 2015-2020 Mitchell. See LICENSE.
-- Sponsored by the Library of the University of Antwerp.
-- Contributions from Ana Balan.
-- Lupa templating engine.
@@ -457,15 +457,18 @@ local function evaluate(ast, env)
if eval(block.expression, env) then
chunks[#chunks + 1] = evaluate(block, env)
else
+ local evaluate_else = true
local elseifs = block['elseif']
if elseifs then
for j = 1, #elseifs do
if eval(elseifs[j].expression, env) then
chunks[#chunks + 1] = evaluate(elseifs[j], env)
+ evaluate_else = false
break
end
end
- elseif block['else'] then
+ end
+ if evaluate_else and block['else'] then
chunks[#chunks + 1] = evaluate(block['else'], env)
end
end