Module:MultiReplace: Difference between revisions

Content deleted Content added
sync from sandbox. Allow call by direct invocation.
Per edit request
 
(4 intermediate revisions by 3 users not shown)
Line 1:
local p = {}
 
local function MultiReplace(args)
Line 11:
if not change.repl then
return require('Module:Error').error{
'MultiReplace: Unpaired argument: <code>' .. (i * 2) .. ' = ' .. mw.text.nowiki(change.pattern) .. '</code>'
}
end
Line 45:
end
 
function p.main(frame, ...)
local args =
if type(frame.args) =~= 'table' thenand {frame, ...} or
if type(frame.args[1]) ~= 'table' and frame thenor
frame.args[1] =and frame.args or
args = frame:getParent().args
if args[1] == '' then
args[1] = frame:getParent().args[1]
end
else
args = frame:getParent().args
end
else
args = frame
end
return MultiReplace(args)
end