Jump to content

Module:MultiReplace and Module:MultiReplace/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
Content deleted Content added
Per edit request
 
add unstrip option
 
Line 1: Line 1:
local p = {}
p = {}


local function MultiReplace(args)
local function MultiReplace(args)
local input = args[1] or "{{{1}}}"
local input = args[1] or "{{{1}}}"
if args.unstrip == "yes" then input = mw.text.unstrip(input) end
local plain = args.plain == "yes"
local plain = args.plain == "yes"


Line 11: Line 13:
if not change.repl then
if not change.repl then
return require('Module:Error').error{
return require('Module:Error').error{
'MultiReplace: Unpaired argument: <code>' .. (i * 2) .. ' = ' .. mw.text.nowiki(change.pattern) .. '</code>'
'MultiReplace: Unpaired argument: <code>' .. (i * 2) .. ' = ' .. change.pattern .. '</code>'
}
}
end
end