Jump to content

Module:Team roster navbox

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Isaacl (talk | contribs) at 01:02, 28 November 2013 (Isaacl moved page Module:Sandbox/isaacl/Team roster navbox to Module:Team roster navbox without leaving a redirect: deploy module). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local me = { }

local Navbox = require('Module:Navbox')

function me.generateRosterNavbox(frame)
    local args = { }
    local parentArgs = frame:getParent().args

    -- Massage the arguments before passing them to the Navbox helper function

    for argName, value in pairs(parentArgs) do
        if value ~= '' then
            if mw.ustring.find(argName, '^list') then
                local listValues = { }
                for entry in mw.text.gsplit(value, '[\n\r]+') do
                  entry = mw.ustring.gsub(entry, '([^%*])%s+', '%1 ')
                  table.insert(listValues, entry)
                end
            	value = table.concat(listValues, '\n')
            end
            args[argName] = value
        end
    end

    -- Note Navbox.navbox() has a kludge to order the parent frame's args
    -- into a specific order. For now, this is omitted from this module.

    return Navbox._navbox(args)

end  -- function me.generateRosterNavbox

return me