Module:PoliticalParty/data: Difference between revisions

From EarthMC
Jump to navigation Jump to search
(Created page with "local p = {} p.partyNames = { ["UAP"] = "Unity and Progress Party", ["Unity and Progress"] = "Unity and Progress Party", ["ADP"] = "Antarctic Democratic Party", ["CLAU"] = "Classical Liberalists of the Antarctic Union", ["PRP"] = "Polar Republic Party" } --color shortname altname tablecolor p.parties = { ["Unity and Progress Party"] = {"#F600C2", "UAP", "Unity and Progress", "#F67CDD"}, ["Antarctic Democratic Party"] = {"#6f56d6", "ADP", "Antarctic Democratic Pa...")
 
mNo edit summary
Line 1: Line 1:
local p = {}
p = {}
local data = require("Module:PoliticalParty/data")


p.partyNames = {
function nameConvert(arg)
["UAP"] = "Unity and Progress Party",
if data.partyNames[arg] ~= nil then
["Unity and Progress"] = "Unity and Progress Party",
return data.partyNames[arg]
["ADP"] = "Antarctic Democratic Party",
else
["CLAU"] = "Classical Liberalists of the Antarctic Union",
return arg
["PRP"] = "Polar Republic Party"
end
}
end


--color shortname altname tablecolor
p.color = function(frame)
p.parties = {
    local arg = frame.args[1]
["Unity and Progress Party"] = {"#F600C2", "UAP", "Unity and Progress", "#F67CDD"},
return data.parties[nameConvert(arg)][1]
["Antarctic Democratic Party"] = {"#6f56d6", "ADP", "Antarctic Democratic Party", "#A798E5"},
end
["Classical Liberalists of the Antarctic Union"] = {"#fdd116", "CLAU", "Classical Liberalists", "#FAE487"},
 
["Polar Republic Party"] = {"red", "PRP", "Polar Republic", "#FB7A7A"}
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


return p
return p

Revision as of 07:19, 14 November 2023

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

p = {}
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

return p