m (undo) Tag: Undo |
mNo edit summary |
||
Line 19: | Line 19: | ||
if version_data.ver then |
if version_data.ver then |
||
if version_data.ver == 'Unknown' then |
if version_data.ver == 'Unknown' then |
||
− | value = ' |
+ | value = 'Unknown' |
if not args.nocat and title.namespace == 0 and not title.isSubpage then |
if not args.nocat and title.namespace == 0 and not title.isSubpage then |
||
category = '[[Category:Unknown al_version]]' |
category = '[[Category:Unknown al_version]]' |
||
Line 30: | Line 30: | ||
end |
end |
||
else |
else |
||
− | value = ' |
+ | value = 'Unspecified' |
if not args.nocat and title.namespace == 0 and not title.isSubpage then |
if not args.nocat and title.namespace == 0 and not title.isSubpage then |
||
category = '[[Category:Pending al_version]]' |
category = '[[Category:Pending al_version]]' |
Latest revision as of 05:54, 6 May 2021
local p = {}
-- Raw version ({{al_version}})
function p.al_version(f)
local args = f
if f == mw.getCurrentFrame() then
args = require('Module:ProcessArgs' ).merge(true)
end
local version = mw.text.trim( args[1] or '' )
-- load the values from the submodule
local version_data = mw.loadData('Module:al_version/Versions').versions[version]
local category = ''
local value
local title = mw.title.getCurrentTitle()
if version_data then
if version_data.ver then
if version_data.ver == 'Unknown' then
value = 'Unknown'
if not args.nocat and title.namespace == 0 and not title.isSubpage then
category = '[[Category:Unknown al_version]]'
end
else
value = version_data.ver
end
else
value = 'N/A'
end
else
value = 'Unspecified'
if not args.nocat and title.namespace == 0 and not title.isSubpage then
category = '[[Category:Pending al_version]]'
end
end
return value .. category
end
-- Version table ({{al_version/table}})
function p.table(f)
local args = f
if f == mw.getCurrentFrame() then
args = require('Module:ProcessArgs').merge(true)
end
local html = {}
local values = mw.loadData('Module:al_version/Versions').list
function table_header()
table.insert(html, '<table class="wikitable sortable jquery-tablesorter">\n')
table.insert(html, '<tr>\n')
table.insert(html, ' <th>Game version</th>\n')
table.insert(html, ' <th>al_version</th>\n')
table.insert(html, '</tr>')
end
table.insert(html, '\n===Classic===\n')
table_header()
for _, version in ipairs(values) do
if version.reset ~= nil then
table.insert(html, '</table>')
table.insert(html, '\n===Indev and Infdev===\n')
table_header()
end
table.insert(html, '<tr>\n')
table.insert(html, ' <td>[[Java Edition ' .. version.name .. '|' .. version.name .. ']]</td>')
table.insert(html, ' <td style="text-align:center;">' .. version.ver .. '</td>')
table.insert(html, '</tr>')
end
table.insert(html, '</table>')
return table.concat(html)
end
return p