Homepage
Games
News
News βΎ
All
Transfers
Drama
Business
Sponsors
Mergers
Investors
Hires
Companies
More
People
Tournaments
Brands
Brands βΎ
Companies
Organizations
Sponsors
Other
Locations
Search
Editing
Module:TalentTable
From TwogPedia
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local cargo = mw.ext.cargo local getArgs = require('Module:Arguments').getArgs local makeFlag = require('Module:Person/Flag').makeFlag local Links = require('Module:Links') local p = {} function p.main(frame) local args = getArgs(frame) local currentTitle = mw.title.getCurrentTitle().text local gameCategory = mw.text.split(currentTitle, '/')[1] local fullString = '' for _, value in ipairs(args) do local tab = mw.text.jsonDecode(value) local container = mw.html.create('div') if tab.topNote then container:wikitext(tab.topNote) end local listCol = 1 local section = 1 local firstSection = true local sections = {} sections[section] = {val = '', lists = {}} sections[section].lists[listCol] = '' for _, tabValue in ipairs(tab) do local role = mw.text.jsonDecode(tabValue) if role.section then if firstSection then firstSection = false else section = section + 1 sections[section] = {val = '', lists = {}} listCol = 1 sections[section].lists[listCol] = '' end sections[section].title = mw.html.create('div'):wikitext(role.section) end if role.div then listCol = listCol + 1 sections[section].lists[listCol] = '' end -- local roleTitle = mw.html.create('div'):addClass('tc'):wikitext(role[1]) -- local roleList = mw.html.create('ul') -- local roleCell = mw.html.create('div'):addClass('talent__role'):node(roleTitle):node(roleList) local roleIcons = { ["Hosts"] = "Tourrnament-players-icon.png", ["Commentators"] = "Tournament-commentators-icon.png", ["Observers"] = "Tournament-observers-icon.png", ["Mandarin Interpreters"] = "Tournament-observers-icon.png", ["Production"] = "Tournament-production-icon.png", ["Statistician"] = "Tournament-statistician-icon.png", ["Coaches"] = "Tournament-coaches-icon.png" } local iconFile = roleIcons[role[1]] or "Tournament-production-icon.png" local roleTitle = mw.html.create('div') :addClass('tc') :wikitext('[[File:' .. iconFile .. '|20px]]' .. role[1]) local roleList = mw.html.create('ul') local roleCell = mw.html.create('div') :addClass('talent__role') :node(roleTitle) :node(roleList) local i = 1 local people = '' if role['t1'] then while role['t' .. i] do people = people .. 'People/' .. role['t' .. i] .. ',' local link = role['t' .. i .. 'link'] or 'People/' .. role['t' .. i] local flag = makeFlag(role['t' .. i .. 'flag'], role['t' .. i .. 'link'] or 'People/' .. role['t' .. i], gameCategory) local talentCell = mw.html.create('li'):wikitext(flag):wikitext('[[' .. link .. '|' .. role['t' .. i] .. ']]') roleList:node(talentCell) i = i + 1 end else roleList:node(mw.html.create('li'):wikitext('TBD')) end frame:callParserFunction{name = '#cargo_store:', args = {_table = 'Talent', people = people, role = role[1]}} sections[section].lists[listCol] = tostring(sections[section].lists[listCol]) .. tostring(roleCell) end for i = 1, #sections do local wrapper = mw.html.create('div') local title = mw.html.create('div'):addClass('talent__stage'):node(sections[i].title) local cell = mw.html.create('div'):addClass('talent__container') for _, subtable in ipairs(sections[i].lists) do cell:node(mw.html.create('div'):node(subtable)) end container:node(wrapper:node(title):node(cell)) end if tab.botNote then container:wikitext(tab.botNote) end fullString = fullString .. tostring(container) end return mw.html.create():wikitext(frame:preprocess(fullString)) end return p
Summary:
Please note that all contributions to TwogPedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
TwogPedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Template used on this page:
Module:TalentTable/doc
(
edit
)
No categories
Edit