Software /
code /
prosody
Diff
util/interpolation.lua @ 11064:af1e3b7d9ea3
util.interpolation: Add '~' as the opposite of '&' (render sub-block if falsy)
One more magic character consumed!
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 09 Sep 2020 17:10:33 +0100 |
parent | 10348:3852fc91b2fc |
child | 11307:f2e276bb4ef8 |
line wrap: on
line diff
--- a/util/interpolation.lua Tue Sep 08 22:50:43 2020 +0200 +++ b/util/interpolation.lua Wed Sep 09 17:10:33 2020 +0100 @@ -64,6 +64,9 @@ elseif opt == '&' then if not value then return ""; end return render(s_sub(block, e), values); + elseif opt == '~' then + if value then return ""; end + return render(s_sub(block, e), values); elseif opt == '?' and not value then return render(s_sub(block, e), values); elseif value ~= nil then