Software /
code /
prosody
Comparison
util/xtemplate.lua @ 13525:0f7e7311eebf
util.xtemplate: Use same argument order in filters even without 'args'
This removes the different argument order used between '{x|foo}' and
'{x|foo(y)}' because the differing order was awkward and confusing.
This util does not seem to be widely used so should not be problematic
to change this part. The only known use is in mod_pubsub, which does not
use the filter function feature.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 16 Oct 2024 16:15:05 +0200 |
parent | 13501:05f028de4c45 |
comparison
equal
deleted
inserted
replaced
13524:cfc42ed3892c | 13525:0f7e7311eebf |
---|---|
68 value = render(tmpl, root, escape, filters); | 68 value = render(tmpl, root, escape, filters); |
69 is_escaped = true; | 69 is_escaped = true; |
70 end | 70 end |
71 elseif filters and filters[func] then | 71 elseif filters and filters[func] then |
72 local f = filters[func]; | 72 local f = filters[func]; |
73 if args == nil then | 73 value, is_escaped = f(value, args, tmpl); |
74 value, is_escaped = f(value, tmpl); | |
75 else | |
76 value, is_escaped = f(args, value, tmpl); | |
77 end | |
78 else | 74 else |
79 error("No such filter function: " .. func); | 75 error("No such filter function: " .. func); |
80 end | 76 end |
81 pipe, pos = s_match(inner, "^(|?)()", p); | 77 pipe, pos = s_match(inner, "^(|?)()", p); |
82 end | 78 end |