Module:Video game release
Appearance
| This module depends on the following other modules: |
| This Lua module is used on approximately 18,000 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
| This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing. |
| This module is currently protected from editing. See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected. |
This module implements the {{Video game release}} and {{Video game release hlist}} templates. The parameter "format" is passed to Module:List to set the output format. Please see the template page for usage instructions and tracking categories.
--require('Module:No globals')
local getArgs = require('Module:Arguments').getArgs
local cd = require('Module:CountryData')
local p = {}
local aliases = {
['NA'] = "[[North America|NA]]",
['EU'] = "[[Europe|EU]]",
['EUR'] = "[[Europe|EU]]",
['AU'] = "[[Australasia|AU]]",
['AUS'] = "[[Australasia|AU]]",
['PAL'] = "[[PAL region|PAL]]",
['JP'] = "[[Japan|JP]]",
['JPN'] = "[[Japan|JP]]",
['RU'] = "[[Russia|RU]]",
['RUS'] = "[[Russia|RU]]",
['BR'] = "[[Brazil|BR]]",
['BRA'] = "[[Brazil|BR]]",
['INT'] = "[[International version|INT]][[Category:Pages using vgrelease with deprecated parameters]]",
['SEA'] = "[[Southeast Asia|SEA]]",
['AS'] = "[[Asia|AS]]",
['SA'] = "[[South America|SA]]",
['WW'] = "<abbr title=\"Worldwide\">WW</abbr>",
['?'] = "<abbr title=\"Unknown\">?</abbr>"
}
local function getLocalAlias(alias)
local label = aliases[alias.toUpper()]
if(label ~= nil) then
label = alias
end
return label
end
local function getCountryData(alias)
local cdtable = cd.gettable(frame,args[i],{})
local label = cdtable['alias']
if(label ~= nil) then
label = alias
end
return label
end
function p.main(frame)
local args = getArgs(frame)
local out = "<ul style=\"list-style: none none; line-height: inherit; margin: 0px;\">"
local i = 1
local j = i+1
while args[i] and args[j] do
local link = getLocalAlias(args[i]);
-- Didn't find a local alias link? Check for country data.
if(link == args[i]) then
link = getCountryData(args[i])
-- Found something? Build a link with it.
if(link ~= args[i]) then
link = "[[" .. link .. "|" .. args[i] .. "]]"
end
end
out = out .. "<li><span style=\"font-size:95%;\">" .. link .. ":</span> " .. args[j] .. "</li>"
i = j + 1
j = i + 1
end
out = out .. "</ul>"
return out
end
return p