Editing Module:Data/Templates

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page is not enabled for semantic in-text annotations due to namespace restrictions. Details about how to enable the namespace can be found on the configuration help page.

Latest revision Your text
Line 10: Line 10:
 
local UTIL = require( 'Module:Util' )
 
local UTIL = require( 'Module:Util' )
  
local function getArg( frame, index )
+
local D = {}
return frame:getParent().args[ index ]
+
 
 +
local function getLanguage( frame )
 +
local v = frame:getParent().args[ 1 ]
 +
 
 +
return DATA.getLanguage( v ) or {}
 
end
 
end
  
 
local function getRegion( frame )
 
local function getRegion( frame )
return DATA.getRegion( getArg( frame, 1 ) ) or {}
+
local v = frame:getParent().args[ 1 ]
end
 
  
local function getLanguage( frame )
+
return DATA.getRegion( v ) or {}
return DATA.getLanguage( getArg( frame, 1 ) ) or {}
 
 
end
 
end
  
 
local function getMedium( frame )
 
local function getMedium( frame )
return DATA.getMedium( getArg( frame, 1 ) ) or {}
+
local v = frame:getParent().args[ 1 ]
 +
 
 +
return DATA.getMedium( v ) or {}
 
end
 
end
  
 
local function getVideoGameName( frame )
 
local function getVideoGameName( frame )
return DATA.videoGames.getName( getArg( frame, 1 ) ) or {}
+
local v = frame:getParent().args[ 1 ]
 +
 
 +
return DATA.videoGames.getName( v ) or {}
 
end
 
end
  
---------------------
+
function D.ln( frame )
-- Wikitext interface
+
return getLanguage( frame ).index or ''
---------------------
+
end
  
local D = {}
+
function D.lang( frame )
 +
return getLanguage( frame ).full or ''
 +
end
  
 
function D.rg( frame )
 
function D.rg( frame )
Line 41: Line 49:
  
 
function D.region( frame )
 
function D.region( frame )
--[[
 
short
 
short2
 
oceanic
 
english
 
after
 
after2
 
]]
 
 
return getRegion( frame ).full or ''
 
return getRegion( frame ).full or ''
end
 
 
function D.ln( frame )
 
return getLanguage( frame ).index or ''
 
end
 
 
function D.lang( frame )
 
return getLanguage( frame ).full or ''
 
 
end
 
end
  
Line 65: Line 57:
  
 
function D.vg( frame )
 
function D.vg( frame )
local full = UTIL.trim( getArg( frame, 'full' ) )
+
local full = UTIL.trim( frame:getParent().args[ 'full' ] )
  
local link = UTIL.trim( getArg( frame, 'link' ) )
+
local link = UTIL.trim( frame:getParent().args[ 'link' ] )
  
 
local game = getVideoGameName( frame )
 
local game = getVideoGameName( frame )
Line 74: Line 66:
 
and ( link and game.full or UTIL.removeDab( game.full or '' ) )
 
and ( link and game.full or UTIL.removeDab( game.full or '' ) )
 
or game.abbr
 
or game.abbr
end
 
 
function D.name( frame )
 
local language = DATA.getLanguage(
 
UTIL.trim( getArg( frame, 2 ) ) or 'en'
 
)
 
 
return language
 
and DATA.getName( getArg( frame, 1 ) or '', language )
 
or '' -- case of invalid language: display empty
 
 
end
 
end
  
 
return D
 
return D
 
-- </pre>
 
-- </pre>

Please note that all contributions to Yugipedia are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 International License (see Yugipedia:Licensing for more details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)
Preview page with this template
Below are some commonly used wiki markup codes. Simply click on what you want to use and it will appear in the edit box above.

View this template