Module:Version link
Jump to navigation
Jump to search
[purge]
This is the documentation page. It will be transcluded into the main module page. See Template:Documentation for more informationCreates a link to a version history page for {{Table/History}}
local p = {}
local function getAetherI( s )
return 'The Aether/Version History#' .. s
end
local function getAetherII( s )
return 'The Aether II/Version History#' .. s
end
local prefixFunctions = {
aether = getAetherI,
a1 = getAetherI,
['the aether'] = getAetherI,
['aether i'] = getAetherI,
['the aether i'] = getAetherI,
['aether one'] = getAetherI,
['the aether one'] = getAetherI,
['aether legacy'] = getAetherI,
['the aether legacy'] = getAetherI,
a2 = getAetherII,
['aether ii'] = getAetherII,
['the aether ii'] = getAetherII,
['aether 2'] = getAetherII,
['the aether 2'] = getAetherII,
['aether two'] = getAetherII,
['the aether two'] = getAetherII,
['aether gotv'] = getAetherII,
['the aether gotv'] = getAetherII,
['aether genesis of the void'] = getAetherII,
['the aether genesis of the void'] = getAetherII,
['aether ii gotv'] = getAetherII,
['the aether ii gotv'] = getAetherII,
['aether ii genesis of the void'] = getAetherII,
['the aether ii genesis of the void'] = getAetherII,
['aether 2 gotv'] = getAetherII,
['the aether 2 gotv'] = getAetherII,
['aether 2 genesis of the void'] = getAetherII,
['the aether 2 genesis of the void'] = getAetherII,
['aether two gotv'] = getAetherII,
['the aether two gotv'] = getAetherII,
['aether two genesis of the void'] = getAetherII,
['the aether two genesis of the void'] = getAetherII,
['aether highlands'] = getAetherII,
['the aether highlands'] = getAetherII,
['aether ii highlands'] = getAetherII,
['the aether ii highlands'] = getAetherII,
['aether 2 highlands'] = getAetherII,
['the aether 2 highlands'] = getAetherII,
['aether two highlands'] = getAetherII,
['the aether two highlands'] = getAetherII,
}
function p.version( s )
local split = mw.text.split(s, '%s')
local prefix = ''
local v = split[#split]
for i = 1, #split, 1 do
if (i == 1) then
prefix = prefix .. split[i]
elseif (i ~= #split) then
prefix = prefix .. ' ' .. split[i]
end
end
prefix = prefix:lower()
local func = prefixFunctions[prefix]
if func then
return func( v )
else
return v
end
end
function p.main( f )
local args = f
if f == mw.getCurrentFrame() then
args = require( [[Module:ProcessArgs]] ).merge( false )
end
local text
if args[2]=='' then
text = mw.ustring.match( args[1], '^.+%s+(%S+)$' )
else
text = args[2] or args[1]
end
return '[[' .. p.version( args[1] ) .. '|' .. text .. ']]'
end
return p