Moduł:Version
Przejdź do nawigacji
Przejdź do wyszukiwania
W tym module nie ma dokumentacji. Jeśli wiesz jak używać tego modułu, proszę, podaj odpowiednie informacje.
local p = {}
p.version = function( f )
local args = f:getParent().args
local versions = mw.loadData( 'Module:Version/Numbers' )
local version = 'pc'
if args.c then
args.classic = '1'
end
for v in pairs( args ) do
if type( v ) == 'string' then
v = v:lower()
if versions[v] then
version = v
break
end
end
end
local edition
if args.s or args.server then
edition = versions[version .. '-server']
end
if not edition then
edition = versions[version]
end
local versionNum = edition[1] or edition
local prefix = edition.prefix or ''
if prefix == 'c' then
prefix = 'Classic'
end
if prefix == 'k' then
prefix = 'Konsola'
end
if prefix == 's' then
prefix = 'Nieoficjalne_wersje'
end
if prefix == 'l' then
prefix = 'Launcher'
end
local style = ''
if args[1] then
style = f:expandTemplate{ title = 'Table Choice', args = { args[1] == versionNum and 'yes' or 'no', '' } }
end
if args.nolink or versionNum == '' then
return style .. ( args[1] or versionNum )
else
return style .. f:expandTemplate{ title = 'Version link', args = {
prefix .. ' ' .. ( args[1] or versionNum ),
args[2] or args[1] or versionNum
} }
end
end
return p