Software /
code /
prosody
Comparison
util/xtemplate.lua @ 13499:1f93e4f78c53
util.xtemplate: Fix error on applying each() to zero stanzas
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 11 Jul 2024 15:04:29 +0200 |
parent | 13394:6debd8dd12ab |
child | 13501:05f028de4c45 |
comparison
equal
deleted
inserted
replaced
13498:aefbc76ac8d2 | 13499:1f93e4f78c53 |
---|---|
37 if not func then func, p = s_match(inner, "^(%w+)()", pos); end | 37 if not func then func, p = s_match(inner, "^(%w+)()", pos); end |
38 if not func then break end | 38 if not func then break end |
39 if tmpl then tmpl = s_sub(tmpl, 2, -2); end | 39 if tmpl then tmpl = s_sub(tmpl, 2, -2); end |
40 if args then args = s_sub(args, 2, -2); end | 40 if args then args = s_sub(args, 2, -2); end |
41 | 41 |
42 if func == "each" and tmpl and st.is_stanza(value) then | 42 if func == "each" and tmpl then |
43 if not st.is_stanza(value) then return pre_blank .. post_blank end | |
43 if not args then value, args = root, path; end | 44 if not args then value, args = root, path; end |
44 local ns, name = s_match(args, "^(%b{})(.*)$"); | 45 local ns, name = s_match(args, "^(%b{})(.*)$"); |
45 if ns then | 46 if ns then |
46 ns = s_sub(ns, 2, -2); | 47 ns = s_sub(ns, 2, -2); |
47 else | 48 else |