Module:Professional wrestling profiles/sandbox
Appearance
![]() | This is the module sandbox page for Module:Professional wrestling profiles (diff). See also the companion subpage for test cases (run). |
Implements {{Professional wrestling profiles}}, and a family of related templates, including Template:Chikara profile, Template:Dragongateusa profile, Template:Gfw profile, Template:NJPW profile, and Template:Roh roster.
Tracking category
function getpropertyvalue(ent, prop)
if ent then return ent:formatPropertyValues(prop).value else return "" end
end
function getpropertyvaluewithdefaultvalues(ent, prop, value1, value2)
local value = value1 or ""; if value == "" then value = value2 or "" end
if value == "" then value = getpropertyvalue(ent, prop) end
return value;
end
function p.getpropertyvalue(frame)
local ent = mw.wikibase.getEntityObject();
local prop = frame.args[1];
return getpropertyvalue(ent, prop);
end
local p = {}
local categories = {}
local ent = mw.wikibase.getEntityObject()
local yesno = require('Module:Yesno')
local getArgs = require('Module:Arguments').getArgs
function p._profiles(args)
local title = mw.title.getCurrentTitle()
local name = args.name or string.gsub(title.text, " %b()", "")
local cagematchid = getpropertyvaluewithdefaultvalues(ent, 'P2728', frame.args["cagematch"], nil);
local wrestlingdataid = getpropertyvaluewithdefaultvalues(ent, 'P2764', frame.args["wrestlingdata"], nil);
local iwdid = getpropertyvaluewithdefaultvalues(ent, 'P2829', frame.args["iwd"], nil);
if (cagematchid == "") and (wrestlingdataid == "") and (iwdid == "") then return "" end
local text = name .. "'s profile at ";
if cagematchid ~= "" then text = text .. "[http://www.cagematch.net/?id=2&nr=" .. cagematchid .. " Cagematch.net], " end
if wrestlingdataid ~= "" then text = text .. "[http://wrestlingdata.com/index.php?befehl=bios&wrestler=" .. wrestlingdataid .. " Wrestlingdata.com], " end
if iwdid ~= "" then text = text .. "[http://www.profightdb.com/wrestlers/" .. iwdid .. ".html Internet Wrestling Database], " end
return string.sub(text, 1, -3);
end
function p.profiles(frame)
local args = getArgs(frame)
return p._profiles(args)
end
return p