Module:USHRseats
Appearance
local p = {}
function p.USHRseats(frame)
state = frame.args[1]
if mw.ustring.len(state)>2 then
state = frame:expandTemplate{ title = 'ConvertAbbrev/ISO 3166-2/US', args = {state} }
end
year = frame.args[2]
if year then
census_number = (year - math.fmod(year,10))/10 - 177
end
states = {
AK = {'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-', 1, 1, 1, 1, 1, 1},
AL = {'-','-','-','-', 3, 5, 7, 7, 6, 8, 8, 9, 9, 10, 9, 9, 9, 8, 7, 7, 7, 7, 7},
AR = {'-','-','-','-','-','-', 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 6, 4, 4, 4, 4, 4, 4},
AZ = {'-','-','-','-','-','-','-','-','-','-','-','-','-', 1, 1, 2, 2, 3, 4, 5, 6, 8, 9},
CA = {'-','-','-','-','-','-','-', 2, 3, 4, 6, 7, 8, 11, 20, 23, 30, 38, 43, 45, 52, 53, 53},
CO = {'-','-','-','-','-','-','-','-','-','-', 1, 2, 3, 4, 4, 4, 4, 4, 5, 6, 6, 7, 7},
CT = {},
DE = {},
FL = {},
GA = {},
HI = {},
IA = {},
ID = {},
IL = {},
IN = {},
KS = {},
KY = {},
LA = {},
MA = {},
MD = {},
ME = {},
MI = {},
MN = {},
MO = {},
MS = {},
MT = {},
NC = {},
ND = {},
NE = {},
NH = {},
NJ = {},
NM = {},
NV = {},
NY = {},
OH = {},
OK = {},
OR = {},
PA = {},
RI = {},
SC = {},
SD = {},
TN = {},
TX = {},
UT = {},
VA = {},
VT = {},
WA = {},
WI = {},
WV = {},
WY = {}
}
if not states[state] then
seats = 'state not recognized'
else
if census_number then
seats = states[state][census_number]
if seats=='-' or not seats then
seats="given year is prior to statehood"
end
else
seats = states[state][#states[state]]
end
end
return seats
end
return p