Module:Professional wrestling profiles
Appearance
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
local getArgs = require('Module:Arguments').getArgs
function getpropertyvalue(ent, prop)
if ent then return ent:formatPropertyValues(prop).value else return "" end
end
function getpropertyvaluewithdefaultvalues(ent, prop, value1, value2)
return value1 or value2 or getpropertyvalue(ent, prop);
end
function getname(frame, name1, name2)
return name1 or name2 or frame:expandTemplate{title = 'PAGENAMEBASE'};
end
local p = {}
function p.getpropertyvalue(frame)
local ent = mw.wikibase.getEntityObject();
local prop = frame.args[1];
return getpropertyvalue(ent, prop);
end
function p.cagematch(frame)
local args = getArgs(frame);
local ent = mw.wikibase.getEntityObject();
local id = getpropertyvaluewithdefaultvalues(ent, 'P2728', args[1], args["id"]);
local name = getname(frame, args[2], args["name"]);
local code = "[http://www.cagematch.net/?id=2&nr=" .. id .. " " .. name .. "]'s profile at Cagematch.net";
return code
end
function p.wrestlingtitlespersonalities(frame)
local args = getArgs(frame);
local id = args[1] or args["id"]; if not id then return "[[Category:Wrestling Titles template with no id set]]" end;
local name = getname(frame, args[2], args["name"]);
local code = "[http://www.wrestling-titles.com/personalities/" .. id .. "/ " .. name .. "]'s profile at Wrestling-Titles.com";
return code
end
function p.profiles(frame)
local args = getArgs(frame);
local ent = mw.wikibase.getEntityObject();
local cagematchid = getpropertyvaluewithdefaultvalues(ent, 'P2728', args["cagematch"], nil);
local wrestlingdataid = getpropertyvaluewithdefaultvalues(ent, 'P2764', args["wrestlingdata"], nil);
local iwdid = getpropertyvaluewithdefaultvalues(ent, 'P2829', args["iwd"], nil);
if (cagematchid == "") and (wrestlingdataid == "") and (iwdid == "") then return "[[Category:Professional wrestling profiles template without any identifiers]]" end
local name = getname(frame, args["name"], nil);
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
return p