| Line 128: |
Line 128: |
| | end | | end |
| | end | | end |
| | + | |
| | + | local special_functions = { |
| | + | apply = function(args) |
| | + | local template = args[2] |
| | + | local values = {} |
| | + | for i = 3, #args do |
| | + | table.insert(values, frame:preprocess(format{ |
| | + | '{{${template}|${arg}}}', |
| | + | template = template, |
| | + | arg = args[i] |
| | + | })) |
| | + | end |
| | + | return table.concat(values, args.concat or "") |
| | + | end |
| | + | } |
| | | | |
| | function interpret_args(args_) | | function interpret_args(args_) |
| | args = args_ | | args = args_ |
| − | local values = {} | + | local special_function = special_functions[args[1]] |
| − | repeat
| + | if special_function then |
| − | for _, arg in ipairs(args_) do
| + | return special_function(args) |
| − | local value = interpret_arg(arg)
| + | else |
| − | if value then
| + | local values = {} |
| − | table.insert(values, value)
| + | repeat |
| | + | for _, arg in ipairs(args_) do |
| | + | local value = interpret_arg(arg) |
| | + | if value then |
| | + | table.insert(values, value) |
| | + | end |
| | end | | end |
| − | end | + | until not sequence or sequence_position > #sequence |
| − | until not sequence or sequence_position > #sequence
| + | return table.concat(values, args.concat or "") |
| − | return table.concat(values, args.concat or "")
| + | end |
| | end | | end |
| | | | |
| Line 151: |
Line 171: |
| | | | |
| | function Calc.test() | | function Calc.test() |
| − |
| |
| | end | | end |
| | | | |
| | return Calc | | return Calc |