Module:Infobox

-- local p = {}

local title = mw.title.getCurrentTitle local data = mw.loadData('Module:Infobox/data')

function p.location(frame) local str = {} local categories = {} for index, location in ipairs(mw.text.split(frame.args[1]), '*', true) do       if index == 2 then table.insert(str, '* ', 1) end -- Accepts: -- Card Castle -- Card Castle -- Card Castle (F1) -- Card Castle (F1) local link, text = mw.ustring.match(mw.text.trim(location), '^%[?%[?([^%]]+)%]?%]?%s*%(?([^)]*)%)?$')       if link then            if index > 1 then                table.insert(str, '\n* ')            end            local ldata = data.locations[link]            if ldata then                if ldata.categories and title.namespace == 0 then                    for _, category in ipairs(ldata.categories) do                        table.insert(categories, '[[Category:')                        table.insert(categories, category)                        table.insert(']]')                    end                end                if ldata.nolink then                    table.insert(str, link)                else                    table.insert(str, )                    table.insert(str, link)                    table.insert(str, )                end            else                table.insert(str, link) end end end return table.concat(str) .. table.concat(categories) end

return p