Difference between revisions of "Module:Data/Templates"
(Get vg info.) |
(Account for {{{link}}} in {{Vg}}.) |
||
Line 8: | Line 8: | ||
local DATA = require( 'Module:Data' ) | local DATA = require( 'Module:Data' ) | ||
+ | local UTIL = require( 'Module:Util' ) | ||
local D = {} | local D = {} | ||
Line 56: | Line 57: | ||
function D.vg( frame ) | function D.vg( frame ) | ||
− | local full = | + | local full = UTIL.trim( frame:getParent().args[ 'full' ] ) |
− | + | ||
+ | local link = UTIL.trim( frame:getParent().args[ 'link' ] ) | ||
+ | |||
+ | local game = getVideoGame( frame ) | ||
+ | |||
+ | return full | ||
+ | and ( link and game.full or UTIL.removeDab( game.full ) ) | ||
+ | or game.abbr | ||
end | end | ||
return D | return D | ||
-- </pre> | -- </pre> |
Revision as of 23:18, 15 February 2019
-- <pre>
--[=[Doc
@module Data/Templates
@description Interface for template interaction.
@author [[User:Becasita]]
@contact [[User talk:Becasita]]
]=]
local DATA = require( 'Module:Data' )
local UTIL = require( 'Module:Util' )
local D = {}
local function getLanguage( frame )
local v = frame:getParent().args[ 1 ]
return DATA.getLanguage( v ) or {}
end
local function getRegion( frame )
local v = frame:getParent().args[ 1 ]
return DATA.getRegion( v ) or {}
end
local function getMedium( frame )
local v = frame:getParent().args[ 1 ]
return DATA.getMedium( v ) or {}
end
local function getVideoGame( frame )
local v = frame:getParent().args[ 1 ]
return DATA.getVideoGame( v ) or {}
end
function D.ln( frame )
return getLanguage( frame ).index or ''
end
function D.lang( frame )
return getLanguage( frame ).full or ''
end
function D.rg( frame )
return getRegion( frame ).index or ''
end
function D.region( frame )
return getRegion( frame ).full or ''
end
function D.rgo( frame )
return getMedium( frame ).abbr or ''
end
function D.vg( frame )
local full = UTIL.trim( frame:getParent().args[ 'full' ] )
local link = UTIL.trim( frame:getParent().args[ 'link' ] )
local game = getVideoGame( frame )
return full
and ( link and game.full or UTIL.removeDab( game.full ) )
or game.abbr
end
return D
-- </pre>