From fe3cb3a530925750efc581483b03b48c5e565ab4 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Sun, 24 Jan 2021 22:55:42 +0200 Subject: [PATCH] [Minor] Update lua-lupa - Fixed bug where 'else' was not evaluated if 'elseif' is present. --- contrib/lua-lupa/lupa.lua | 7 +++++-- 1 file 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 -- 2.39.5