Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Documentation for this module may be created at Module:Talent/doc

local p = {}
local html = mw.html

function p.main(frame)
    local args = frame:getParent().args
    local container = html.create('div'):addClass('talent-container')

    -- Loop through group1, group2...
    for i = 1, 20 do
        local role = args['group' .. i]
        local people = args['list' .. i]

        if role and role ~= "" and people and people ~= "" then
            -- Create the Row
            local row = container:tag('div'):addClass('talent-row')

            -- 1. The Header (Left Side)
            row:tag('div'):addClass('talent-header'):wikitext(role)

            -- 2. The Pills Container (Right Side)
            local listDiv = row:tag('div'):addClass('talent-list')
            
            local items = mw.text.split(people, ",")
            for _, name in ipairs(items) do
                name = mw.text.trim(name)
                -- If user accidentally leaves an empty comma
                if name ~= "" then
                    -- Simple Text Pill
                    listDiv:tag('div'):addClass('talent-pill')
                        :wikitext('[[' .. name .. ']]')
                end
            end
        end
    end
    
    return tostring(container)
end

return p