Module:PoliticalParty: Difference between revisions

From EarthMC
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
Line 1: Line 1:
p = {}
p = {}
local yesno = require('Module:Yesno')
local data = require("Module:PoliticalParty/data")
local data = require("Module:PoliticalParty/data")


Line 46: Line 47:
p.won = function(frame)
p.won = function(frame)
     local arg = frame.args[1]
     local arg = frame.args[1]
if arg == "yes" then
if yesno(arg) == true then
return "background:#ECFCF4;"
return "background:#ECFCF4;"
else
else

Latest revision as of 19:18, 4 December 2023

Documentation for this module may be created at Module:PoliticalParty/doc

p = {}
local yesno = require('Module:Yesno')
local data = require("Module:PoliticalParty/data")

function nameConvert(arg)
	if data.partyNames[arg] ~= nil then
		return data.partyNames[arg]
	else
		return arg
	end
end

p.color = function(frame)
    local arg = frame.args[1]
	return data.parties[nameConvert(arg)][1]
end

p.shortname = function(frame)
    local arg = frame.args[1]
	return data.parties[nameConvert(arg)][2]
end

p.altname = function(frame)
    local arg = frame.args[1]
	return data.parties[nameConvert(arg)][3]
end

p.tablecolor = function(frame)
    local arg = frame.args[1]
	return data.parties[nameConvert(arg)][4]
end

p.link = function(frame)
    local arg = frame.args[1]
	return data.parties[nameConvert(arg)][5]
end

p.linkedShort = function(frame)
    local arg = frame.args[1]
	if nameConvert(arg) == "Independent" then
		return frame:preprocess("''Independent''")
	else
		return frame:preprocess("[["..data.parties[nameConvert(arg)][5].."|"..data.parties[nameConvert(arg)][2].."]]")
	end
end

p.won = function(frame)
    local arg = frame.args[1]
	if yesno(arg) == true then
		return "background:#ECFCF4;"
	else
		return ""
	end
end

return p