Module:Election table category
Appearance
Documentation for this module may be created at Module:Election table category/doc
local p = {}
local subDivisionNames = {
germany = {
name = "Germany",
"Baden",
"Bavaria",
"Berlin",
"Brandenburg",
"Bremen",
"Hamburg",
"Hesse",
"Holstein",
"Lower Saxony",
"Mecklenburg",
"North Rhine",
"Palatinate",
"Rhineland",
"Saarland",
"Saxony",
"Saxony-Anhalt",
"Schleswig",
"Thuringia",
"Western Pomerania",
"Westphalia",
"Württemberg",
},
india = {
name = "India",
"Andaman",
"Andhra Pradesh",
"Arunachal Pradesh",
"Assam",
"Bihar",
"Chandigarh",
"Chhattisgarh",
"Dadra",
"Daman",
"Diu",
"Goa",
"Gujarat",
"Haryana",
"Himachal Pradesh",
"Jammu",
"Jharkhand",
"Kashmir",
"Karnataka",
"Kerala",
"Ladakh",
"Lakshadweep",
"Madhya Pradesh",
"Maharashtra",
"Manipur",
"Meghalaya",
"Mizoram",
"Nagaland",
"Nagar Haveli",
"Nicobar Islands",
"Odisha",
"Puducherry",
"Punjab",
"Rajasthan",
"Sikkim",
"Tamil Nadu",
"Telangana",
"Tripura",
"Union territory",
"Uttar Pradesh",
"Uttarakhand",
"West Bengal",
},
indonesia = {
name = "Indonesia",
"Aceh",
"Bali",
"Bangka Belitung Islands",
"Banten",
"Bengkulu",
"Central Java",
"Central Kalimantan",
"Central Sulawesi",
"East Java",
"East Kalimantan",
"East Nusa Tenggara",
"Gorontalo",
"Jakarta",
"Jambi",
"Lampung",
"Maluku",
"North Kalimantan",
"North Maluku",
"North Sulawesi",
"North Sumatra",
"Papua",
"Riau Islands",
"Riau",
"South Kalimantan",
"South Sulawesi",
"South Sumatra",
"Southeast Sulawesi",
"West Java",
"West Kalimantan",
"West Nusa Tenggara",
"West Papua",
"West Sulawesi",
"West Sumatra",
},
malaysia = {
name = "Malaysia",
"Johor",
"Johore",
"Kedah",
"Kelantan",
"Malacca",
"Negeri Sembilan",
"Negri Sembilan",
"Pahang",
"Penang",
"Perak",
"Perlis",
"Sabah",
"Sarawak",
"Selangor",
"Terengganu",
"Trengganu",
"Tringganu",
},
}
local function getNameFromTableTitle(title)
for _, country in pairs(subDivisionNames) do
for _, subDivision in pairs(country) do
if (string.find(title, subDivision)) then
return country.name
end
end
end
end
function p.main(frame)
local getArgs = require("Module:Arguments").getArgs
local args = getArgs(frame)
local title = args[1] or args.title
mw.log(title)
if title then
return getNameFromTableTitle(title)
end
end
return p