View source for Module:ApplyPattern

Jump to navigation Jump to search

You do not have permission to edit this page, for the following reason:

The action you have requested is limited to users in the group: Users.


You can view and copy the source of this page.

local p = {}
function split(instr,sep)
local sep, fields = sep or ":", {}
local pattern = string.format("([^%s]+)", sep)
string.gsub(instr, pattern, function(c) fields[#fields+1] = c end)
return fields
end
function trim(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
function p.apply(frame)
local list = frame.args[1]
local pattern = frame.args[2]
local result = {}
local sep = ','
for key,entry in pairs(split(list,sep)) do
result[#result+1] = string.gsub(pattern, '%%pattern%%', trim(entry))
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
000
1:0
Debug console
* The module exports are available as the variable "p", including unsaved modifications. * Precede a line with "=" to evaluate it as an expression or use print(). Use mw.logObject() for tables. * Use mw.log() and mw.logObject() in module code to send messages to this console.

Template used on this page:

Return to Module:ApplyPattern.