diff options
author | Kim Alvefur <zash@zash.se> | 2019-10-20 20:53:34 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-10-20 20:53:34 +0200 |
commit | e172a10f71d403b8fcb3cda963c2fa4f25c9abb5 (patch) | |
tree | e12e22f45769caf55de9030483ba480fd772df30 | |
parent | d2639a69153d6c00f39faf48471f7f9bbc34d8a2 (diff) | |
parent | e55d816cdd519667a206149099a60e2ee6b5a91d (diff) | |
download | prosody-e172a10f71d403b8fcb3cda963c2fa4f25c9abb5.tar.gz prosody-e172a10f71d403b8fcb3cda963c2fa4f25c9abb5.zip |
Merge 0.11->trunk
-rw-r--r-- | util/interpolation.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/util/interpolation.lua b/util/interpolation.lua index 315cc203..e0ccf47b 100644 --- a/util/interpolation.lua +++ b/util/interpolation.lua @@ -32,7 +32,7 @@ local function new_render(pat, escape, funcs) -- assert(type(values) == "table", "bad argument #2 to 'render' (table expected)"); return (s_gsub(template, pat, function (block) block = s_sub(block, 2, -2); - local name, opt, e = s_match(block, "^([%a_][%w_.]*)(%p?)()"); + local name, raw, opt, e = s_match(block, "^([%a_][%w_.]*)(!?)(%p?)()"); if not name then return end local value = values[name]; if not value and name:find(".", 2, true) then @@ -45,7 +45,7 @@ local function new_render(pat, escape, funcs) if funcs then while value ~= nil and opt == '|' do local f; - f, opt, e = s_match(block, "^([%a_][%w_.]*)(%p?)()", e); + f, raw, opt, e = s_match(block, "^([%a_][%w_.]*)(!?)(%p?)()", e); f = funcs[f]; if f then value = f(value); end end @@ -70,7 +70,7 @@ local function new_render(pat, escape, funcs) if type(value) ~= "string" then value = tostring(value); end - if opt ~= '!' then + if raw ~= '!' then return escape(value); end return value; |