Editing Module:AeroWikiListTools
From Aeronautica Official Wiki
More actions
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
local getArgs = require('Module:Arguments').getArgs | local getArgs = require('Module:Arguments').getArgs | ||
Line 15: | Line 12: | ||
p.split_list = makeInvokeFunc('_split_list') | p.split_list = makeInvokeFunc('_split_list') | ||
p._split_list = function (args) | p._split_list = function (args) | ||
local input_string = args[1] | |||
local input_string = args[1] | local template = args[2] | ||
local template = args[2] | |||
local new_string = '' | local new_string = '' | ||
if input_string == nil or template == nil then | if input_string == nil or template == nil then | ||
return | return ' Unknown/None' | ||
end | end | ||
for split in string.gmatch(input_string , '([^,]+)') do | for split in string.gmatch(input_string , '([^,]+)') do | ||
new_string = new_string .. template:gsub('{split}', split:match('^%s*(.-)%s*$')) .. ' ' | new_string = new_string .. template:gsub('{split}', split:match('^%s*(.-)%s*$')) .. ' ' | ||
end | end | ||
if template:sub(-1) == ',' then | if template:sub(-1) == ',' then | ||
new_string = new_string:sub(1, -3) | new_string = new_string:sub(1, -3) | ||
Line 43: | Line 30: | ||
end | end | ||
return new_string | return new_string | ||
end | end | ||
return p | return p |