Module:PHL sports team and Module:PHL sports team/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
MarcusAbacus (talk | contribs) No edit summary |
use require('strict') instead of require('Module:No globals') |
||
Line 106: | Line 106: | ||
local key = get_key_by_code(in_team, data) |
local key = get_key_by_code(in_team, data) |
||
local team = data[key] |
local team = data[key] |
||
if (team == nil) then return |
if (team == nil) then return error(string.format('Invalid team: %s', in_team)) end |
||
local out |
local out |
||
Line 117: | Line 117: | ||
elseif (args[3] == constants.SHORT) then out = team[7] or key or in_team |
elseif (args[3] == constants.SHORT) then out = team[7] or key or in_team |
||
else out = in_name or team[in_div] end |
else out = in_name or team[in_div] end |
||
if (out == nil) then return |
if (out == nil) then return error('No ' .. divLt[in_div-2] .. ' team') end |
||
else |
else |
||
out = team[7] or key or in_team |
out = team[7] or key or in_team |
||
Line 149: | Line 149: | ||
local data = load_data(args) |
local data = load_data(args) |
||
local in_team = stripwhitespace(args[1] or '') |
local in_team = stripwhitespace(args[1] or '') |
||
⚫ | |||
local note = '' |
local note = '' |
||
if in_team and in_team:match('[%*]$') then |
if in_team and in_team:match('[%*]$') then |
||
Line 157: | Line 156: | ||
if (in_team:match('^{{{.*}}}$') ~= nil) then |
if (in_team:match('^{{{.*}}}$') ~= nil) then |
||
return show_empty_param(in_team) .. note |
return show_empty_param(in_team) .. note |
||
elseif (in_team == '' or nil) then return |
elseif (in_team == '' or nil) then return '—' .. note end |
||
local key = get_key_by_code(in_team, data) |
local key = get_key_by_code(in_team, data) |
||
if ((data[in_team] or data[key]) == nil) then |
if ((data[in_team] or data[key]) == nil) then |
||
⚫ | |||
return no_img .. note |
|||
end |
end |
||
return get_icon(key or in_team, args['size'], args[2]) .. note |
return get_icon(key or in_team, args['size'], args[2]) .. note |
||
Line 179: | Line 178: | ||
end |
end |
||
if not team then return |
if not team then return error(string.format('Invalid team: %s', code)) end |
||
if args[2] == constants.SHORT then out = team[2] or code |
if args[2] == constants.SHORT then out = team[2] or code |
||
elseif name then out = team[name] or name |
elseif name then out = team[name] or name |
||
Line 191: | Line 190: | ||
local athl_2 = args['athl2'] |
local athl_2 = args['athl2'] |
||
if athl_1 == nil then return |
if athl_1 == nil then return error('Invalid athlete: no value') end |
||
local link = get_athlete_link(args['link'], athl_1) |
local link = get_athlete_link(args['link'], athl_1) |
||
Line 229: | Line 228: | ||
p.color = makeInvokeFunc('_color') |
p.color = makeInvokeFunc('_color') |
||
p.pba = makeInvokeFunc('_generic', 'PBA') |
p.pba = makeInvokeFunc('_generic', 'PBA') |
||
p.mpbl = makeInvokeFunc('_generic', 'MPBL') |
|||
p.athlete = makeInvokeFunc('_athlete_bc') |
p.athlete = makeInvokeFunc('_athlete_bc') |
||