aboutsummaryrefslogtreecommitdiffstats
path: root/util/xtemplate.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util/xtemplate.lua')
-rw-r--r--util/xtemplate.lua9
1 files changed, 3 insertions, 6 deletions
diff --git a/util/xtemplate.lua b/util/xtemplate.lua
index 56413012..446d7d1f 100644
--- a/util/xtemplate.lua
+++ b/util/xtemplate.lua
@@ -39,7 +39,8 @@ local function render(template, root, escape, filters)
if tmpl then tmpl = s_sub(tmpl, 2, -2); end
if args then args = s_sub(args, 2, -2); end
- if func == "each" and tmpl and st.is_stanza(value) then
+ if func == "each" and tmpl then
+ if not st.is_stanza(value) then return pre_blank .. post_blank end
if not args then value, args = root, path; end
local ns, name = s_match(args, "^(%b{})(.*)$");
if ns then
@@ -69,11 +70,7 @@ local function render(template, root, escape, filters)
end
elseif filters and filters[func] then
local f = filters[func];
- if args == nil then
- value, is_escaped = f(value, tmpl);
- else
- value, is_escaped = f(args, value, tmpl);
- end
+ value, is_escaped = f(value, args, tmpl);
else
error("No such filter function: " .. func);
end