Jump to content

Module:Infobox road/color/sandbox

From Wikipedia, the free encyclopedia
local p = {}

local getArgs = require('Module:Arguments').getArgs	


function color(args, country)
	local args = getArgs(frame)
	local countryAbbr = args.country
	local type = args.type
	
	for i,countryAbbr in pairs({'BEL', 'BGD', 'EUR', 'IND', 'ISL', 'SWE', 'VNM'}) do
    	header = countryAbbr
	end
	
	for i,countryAbbr in pairs({'ARG', 'BOL', 'CHL', 'CHN', 'CRI', 'ECU', 'HKG', 'MEX', 'NZL', 'URY'}) do
    	header = "MUTCDgreen"
	end

	for i,countryAbbr in pairs({'EST', 'JOR'}) do
    	header = "motorway"
	end
	
	for i,countryAbbr in pairs({'ALB'}) do
		for i,type in pairs({'A'}) do
    		header = "EUR"
    	end
    	header = countryAbbr
    end

	for i,countryAbbr in pairs({'AUS'}) do
		for i,type in pairs({'freeway', 'highway', 'road', 'street', 'track'}) do
    		header = "AUS-" .. type
		end
		for i,type in pairs({'city highway'}) do
    		header = "AUS-highway"
		end
		for i,type in pairs({'rural road'}) do
    		header = "AUS-road"
    	end
    	header = countryAbbr
    end
	
	for i,countryAbbr in pairs({'AUT'}) do
		for i,type in pairs({'A', 'S', 'B'}) do
    		header = countryAbbr
    	end
    	header = "minor"
    end

	for i,countryAbbr in pairs({'BIH'}) do
		for i,type in pairs({'M', 'B', 'R'}) do
    		header = "BIH-" .. type
    	end
    	header = countryAbbr
	end
	
	for i,countryAbbr in pairs({'BGR'}) do
		for i,type in pairs({'A'}) do
    		header = "MUTCDgreen"
    	end
    	header = "MUTCDblue"
    end

	for i,countryAbbr in pairs({'CAN'}) do
		for i,type in pairs({'A', 'Autoroute', 'Fwy', 'Toronto'}) do
    		header = "MUTCDblue"
		end
		for i,type in pairs({'QC OLD'}) do
    		header = "deleted"
		end
			header = "MUTCDgreen"
    end	

	for i,countryAbbr in pairs({'HRV'}) do
		for i,type in pairs({'D', 'Z'}) do
    		header = "BIH-" .. type
    	end
		for i,type in pairs({'E', 'A'}) do
    		header = "EUR"
    	end
	    header = "default"
	end

	for i,countryAbbr in pairs({'CYP'}) do
		for i,type in pairs({'A'}) do
    		header = "CYP-" .. type
    	end
    	header = countryAbbr
		end
	
	for i,countryAbbr in pairs({'CZE'}) do
		for i,type in pairs({'D', 'R'}) do
    		header = "MUTCDgreen"
    	end
    	header = "MUTCDblue"
	end

	for i,countryAbbr in pairs({'DNK'}) do
		for i,type in pairs({'S'}) do
    		header = "DNK-" .. type
    	end
		for i,type in pairs({'E', 'M'}) do
    		header = "MUTCDgreen"
    	end
    	header = countryAbbr
		end

	for i,countryAbbr in pairs({'FIN'}) do
		for i,type in pairs({'E'}) do
    		header = "FIN-" .. type
    	end
    	header = countryAbbr
	end

	for i,countryAbbr in pairs({'FRA', 'MTQ', 'DZA'}) do
    	for i,type in pairs({'A'}) do
    		header = "motorway"
		end
		for i,type in pairs({'N'}) do
    		header = "MUTCDgreen"
		end
		for i,type in pairs({'E'}) do
    		header = "FRA-E"
    	end
		header = "minor"
	end
	
	for i,countryAbbr in pairs({'GEO'}) do
		for i,type in pairs({'A', 'International'}) do
    		header = "GEO-A"
    	end
    	header = "default"
    end

	for i,countryAbbr in pairs({'DEU'}) do
		for i,type in pairs({'A', 'Autobahn'}) do
    		header = "DEU-A"
		end
		for i,type in pairs({'B', 'Bundesstraße', 'Bundesstrasse'}) do
    		header = "DEU-B"
		end
		for i,type in pairs({'E'}) do
    		header = "EUR"
    	end
		for i,type in pairs({'Scenic'}) do
    		header = "DEU-scenic"
    	end
		header = "default"
	end
	
	for i,countryAbbr in pairs({'GHA'}) do
		for i,type in pairs({'N'}) do
    		header = "motorway"
    	end
    	header = "MUTCDgreen"
	end
	
	for i,countryAbbr in pairs({'GRC'}) do
		for i,type in pairs({'A'}) do
    		header = "MUTCDgreen"
    	end
    	header = "motorway"
	end
	
	for i,countryAbbr in pairs({'HUN'}) do
		for i,type in pairs({'M'}) do
    		header = "motorway"
    	end
    	header = "MUTCDgreen"
	end

	for i,countryAbbr in pairs({'IRN'}) do
		for i,type in pairs({'freeway'}) do
    		header = "Motorway"
		end
		for i,type in pairs({'expressway', 'road'}) do
    		header = "IRN-expressway"
		end
		for i,type in pairs({'boulevard', 'street'}) do
    		header = "minor"
    	end
		header = "default"
	end

	for i,countryAbbr in pairs({'IRL'}) do
		for i,type in pairs({'M'}) do
    		header = "Motorway"
		end
		for i,type in pairs({'N'}) do
    		header = "Aprimary"
		end
		for i,type in pairs({'R'}) do
    		header = "minor"
    	end
		header = "default"
	end

		--[[do -- Israel
			local ISR = Country:new{default = "background:#007E00; color:#fff;"}
			ISR:addTypesAsColor({"Fwy", "Freeway", "Dual"}, "background:#0000FE; color:#fff;")
			colors.ISR = ISR
		end -- Israel
		do -- Italy
			local ITA = Country:new{default = "default"}
			ITA:addTypesAsColor({"A"}, "EUR")
			ITA:addTypesAsColor({"RA"}, "EUR")
			ITA:addTypesAsColor({"SS"}, "MUTCDblue")
			ITA:addTypesAsColor({"E"}, "EUR")
			colors.ITA = ITA
		end -- Italy
        do -- Kosovo
			local KOS = Country:new{default = "background:#0066cc; color:#fff;"}
			KOS:addTypesAsColor({"R"}, "background:#009933; color:#fff;")
			KOS:addTypesAsColor({"E"}, "EUR")
			colors.KOS = KOS
		end -- Kosovo
		do -- Nepal
			local NPL = Country:new{default = "minor"}
			-- NPL:addTypesAsColor({"M", "Motorway", "AM", "MNamed"}, "motorway")
			NPL:addTypesAsColor({"H"}, "background:#00703C; color:#fff;")
			colors.NPL = NPL
		end -- Nepal
		do -- Netherlands
			local NLD = Country:new{default = "motorway"}
			NLD:addTypesAsColor({"E"}, "EUR")
			colors.NLD = NLD
		end -- Netherlands
		do -- Norway
			local NOR = Country:new{default = "background:#F2A900;"}
			NOR:addTypesAsColor({"E"}, "background:#00965E; color:#fff;")
			colors.NOR = NOR
		end -- Norway
		do -- Northern Ireland
			local NIR = Country:new{default = "minor"}
			NIR:addTypesAsColor({"M", "Motorway", "AM", "MNamed"}, "motorway")
			NIR:addTypesAsColor({"A", "Primary"}, "Aprimary")
			colors.NIR = NIR
		end -- Northern Ireland
		do -- Malaysia
			local MYS = Country:new{default = "motorway"}
			MYS:addTypesAsColor({"E"}, "MUTCDgreen")
			colors.MYS = MYS
		end -- Malaysia
		do -- Morocco
			local MAR = Country:new{default = "minor"}
			MAR:addTypesAsColor({"A"}, "motorway")
			MAR:addTypesAsColor({"Motorway"}, "motorway")
			colors.MAR = MAR
		end -- Morocco
        do -- Pakistan
			local PAK = Country:new{default = "background:#0066cc; color:#fff;"}
			PAK:addTypesAsColor({"M"}, "background:#22B14C; color:#fff;")
			PAK:addTypesAsColor({"E"}, "background:#F5C31D; color:#000;")
			colors.PAK = PAK
		end -- Pakistan
		do -- Philippines
            local PHL = Country:new{default = "background:#093; color:#fff;"}
            PHL:addTypesAsColor({"AH", "Asian Highway"}, "background:#1e2c76; color:#fff;")
            colors.PHL = PHL
        end -- Philippines 
		do -- Poland
			local POL = Country:new{default = "MUTCDgreen"}
			POL:addTypesAsColor({"A", "S"}, "motorway")
			colors.POL = POL
		end --Poland 
		do -- Russia
			local RUS = Country:new{default = "background:#0d69e1; color:#fff;"}
			RUS:addTypesAsColor({"E"}, "background:#00a500; color:#fff;")
			RUS:addTypesAsColor({"AH"}, "background:#00004e; color:#fff;")
			colors.RUS = RUS
		end --Russia
		do -- Slovakia
			local SVK = Country:new{default = "motorway"}
			SVK:addTypesAsColor({"D", "R"}, "MUTCDgreen")
			colors.SVK = SVK
		end -- Slovakia
		do -- South Africa
			local ZAF = Country:new{default = "MUTCDgreen"}
			ZAF:addTypesAsColor({"M", "N"}, "motorway")
			colors.ZAF = ZAF
		end -- South Africa
		do -- Spain
			local ESP = Country:new{default = "background:#E8E8E8;"}
			ESP:addTypesAsColor({"E"}, "background:#13926C; color:#fff;")
			ESP:addTypesAsColor({"A", "AP", "R", "Autovia", "Autovía", "Autopista", "autovia", "autovía", "autopista"}, "background:#19408B; color:#fff;")
			ESP:addTypesAsColor({"N", "national", "nacional"}, "background:#bf0411; color:#fff;")
			ESP:addTypesAsColor({"autonomica1", "autonómica1"}, "background:#E96310; color:#000;")
			ESP:addTypesAsColor({"autonomica2", "autonómica2"}, "background:#5D3F0F; color:#fff;")
			ESP:addTypesAsColor({"autonomica3", "autonómica3"}, "background:#F4B70D; color:#000;")
			colors.ESP = ESP
		end -- Spain
		do -- Sri Lanka
			local LKA = Country:new{default = "MUTCDgreen"}
			LKA:addTypesAsColor({"E"}, "motorway")
			LKA:addTypesAsColor({"A"}, "MUTCDgreen")
			colors.LKA = LKA
		end -- Sri Lanka
		do -- Switzerland
			local CHE = Country:new{default = "default"}
			CHE:addTypesAsColor({"E"}, "EUR")
			colors.CHE = CHE
		end -- Switzerland
		do -- Thailand
			local THA = Country:new{default = "MUTCDgreen"}
			THA:addTypesAsColor({"AH", "T"}, "MUTCDblue")
			colors.THA = THA
		end -- Thailand
		do -- Turkey
			local TUR = Country:new{default = "MUTCDgreen"}
			TUR:addTypesAsColor({"state", "D"}, "MUTCDblue")
			TUR:addTypesAsColor({"E"}, "EUR")
			colors.TUR = TUR
		end -- Turkey
		do -- Ukraine
			local UKR = Country:new{default = "background:#0000cc; color:#fff;"}
			UKR:addTypesAsColor({"E"}, "background:#009900; color:#fff;")
			colors.UKR = UKR
		end -- Ukraine]]
		
	
	for i,countryAbbr in pairs({'GBR', 'IMN'}) do
    	for i,type in pairs({'M', 'Motorway', 'AM', 'MNamed'}) do
    		header = "motorway"
		end
		for i,type in pairs({'A', 'Primary'}) do
    		header = "Aprimary"
		end
		header = "minor"
	end
	
	for i,countryAbbr in pairs({'USA'}) do
    	for i,type in pairs({"FFH", "FR", "NER", "Rec", "RE", "Park", "Pkwy", "NSB", "NFSB", "FSB", "Scenic", "SB", "Post", "Postal"}) do
    		header = "hist"
		end
		header = "MUTCD-green"
	end
	
	if countryAbbr == '' or countryAbbr == nil then
		return "default"
	else return header
	end
end

function p._color(args)
	return color(args, country)
end


return p