No edit summary |
No edit summary |
||
Line 18: | Line 18: | ||
-- General | -- General | ||
if value == 'COACH' then | if value == 'COACH' then | ||
catName = 'Coaches' | |||
visibleName = 'Coach' | visibleName = 'Coach' | ||
end | end | ||
if value == 'MANAGER' then | if value == 'MANAGER' then | ||
catName = 'Managers' | |||
visibleName = 'Manager' | visibleName = 'Manager' | ||
end | end | ||
Line 28: | Line 28: | ||
-- Dota 2 | -- Dota 2 | ||
if value == 'CARRY' then | if value == 'CARRY' then | ||
catName = 'Carry_players' | |||
visibleName = 'Carry' | visibleName = 'Carry' | ||
end | end | ||
if value == 'HARD SUPPORT' then | if value == 'HARD SUPPORT' then | ||
catName = 'Hard_support_players' | |||
visibleName = 'Hard support' | visibleName = 'Hard support' | ||
end | end | ||
if value == 'OFFLANE' then | if value == 'OFFLANE' then | ||
catName = 'Offlaners' | |||
visibleName = 'Offlane' | visibleName = 'Offlane' | ||
end | end | ||
Line 42: | Line 42: | ||
-- Dota and LoL overlap | -- Dota and LoL overlap | ||
if value == 'SUPPORT' then | if value == 'SUPPORT' then | ||
catName = 'Support_players' | |||
visibleName = 'Support' | visibleName = 'Support' | ||
end | end | ||
if value == 'MID' then | if value == 'MID' then | ||
catName = 'Mid_players' | |||
visibleName = 'Mid' | visibleName = 'Mid' | ||
end | end | ||
Line 52: | Line 52: | ||
-- LoL | -- LoL | ||
if value == 'TOP' then | if value == 'TOP' then | ||
catName = 'Top_players' | |||
visibleName = 'Top' | visibleName = 'Top' | ||
end | end | ||
if value == 'BOT' then | if value == 'BOT' then | ||
catName = 'Bot_players' | |||
visibleName = 'Bot' | visibleName = 'Bot' | ||
end | end | ||
if value == 'JUNGLE' then | if value == 'JUNGLE' then | ||
catName = 'Junglers' | |||
visibleName = 'Jungle' | visibleName = 'Jungle' | ||
end | end | ||
Line 66: | Line 66: | ||
-- CS:GO Values | -- CS:GO Values | ||
if value == 'AWPER' then | if value == 'AWPER' then | ||
catName = 'AWPers' | |||
visibleName = 'Top' | visibleName = 'Top' | ||
end | end | ||
if value == 'SUPPORT' then | -- if value == 'SUPPORT' then | ||
-- catName = 'Support' | |||
-- visibleName = 'Support' | |||
end | -- end | ||
if value == 'RIFLER' then | if value == 'RIFLER' then | ||
catName = 'Riflers' | |||
visibleName = 'Rifler' | visibleName = 'Rifler' | ||
end | end | ||
if value == 'IGL' or value == 'IN-GAME LEADER' then | if value == 'IGL' or value == 'IN-GAME LEADER' then | ||
catName = 'In-game_leaders' | |||
visibleName = 'In-game Leader' | visibleName = 'In-game Leader' | ||
end | end | ||
local categoryLink = '[[:Category:' .. game .. '/' .. | local categoryLink = '[[:Category:' .. game .. '/' .. catName .. '|' .. visibleName ..']]' | ||
valueNode:wikitext(categoryLink) | valueNode:wikitext(categoryLink) | ||
container:node(valueNode) | container:node(valueNode) |
Revision as of 21:57, 31 August 2022
Documentation for this module may be created at Module:Infobox/Widget/Role/doc
local Role = {}
function Role.make(rowName, role, game)
local array = mw.text.split(role, ',')
for i, v in ipairs(array) do
v = mw.text.trim(v)
v = string.upper(v)
local valueNode = mw.html.create('div')
-- If no game then return value without link
if game == nil then
return container:node(valueNode:wikitext(v))
end
local catName = ''
local visibleName = ''
-- General
if value == 'COACH' then
catName = 'Coaches'
visibleName = 'Coach'
end
if value == 'MANAGER' then
catName = 'Managers'
visibleName = 'Manager'
end
-- Dota 2
if value == 'CARRY' then
catName = 'Carry_players'
visibleName = 'Carry'
end
if value == 'HARD SUPPORT' then
catName = 'Hard_support_players'
visibleName = 'Hard support'
end
if value == 'OFFLANE' then
catName = 'Offlaners'
visibleName = 'Offlane'
end
-- Dota and LoL overlap
if value == 'SUPPORT' then
catName = 'Support_players'
visibleName = 'Support'
end
if value == 'MID' then
catName = 'Mid_players'
visibleName = 'Mid'
end
-- LoL
if value == 'TOP' then
catName = 'Top_players'
visibleName = 'Top'
end
if value == 'BOT' then
catName = 'Bot_players'
visibleName = 'Bot'
end
if value == 'JUNGLE' then
catName = 'Junglers'
visibleName = 'Jungle'
end
-- CS:GO Values
if value == 'AWPER' then
catName = 'AWPers'
visibleName = 'Top'
end
-- if value == 'SUPPORT' then
-- catName = 'Support'
-- visibleName = 'Support'
-- end
if value == 'RIFLER' then
catName = 'Riflers'
visibleName = 'Rifler'
end
if value == 'IGL' or value == 'IN-GAME LEADER' then
catName = 'In-game_leaders'
visibleName = 'In-game Leader'
end
local categoryLink = '[[:Category:' .. game .. '/' .. catName .. '|' .. visibleName ..']]'
valueNode:wikitext(categoryLink)
container:node(valueNode)
end
return container
end
return Role