Module:Infobox road/errors

.mw-parser-output .documentation,.mw-parser-output .documentation-metadata{border:1px solid var(--border-color-base,#a2a9b1);background-color:#ecfcf4;color:inhe

Module:Infobox road/errors
local p = {}
local getArgs = require('Module:Arguments').getArgs
local util = require("Module:Road data/util")
local yesno = require('Module:Yesno')
local routeModule = require("Module:Infobox road/route")
local parserModule = require("Module:Road data/parser")
local parser = parserModule.parser
local format = mw.ustring.format
local frame = mw.getCurrentFrame()

local function country(args)
	local state = args.state or args.province
	local country
	local countryModule = mw.loadData("Module:Road data/countrymask")
	local country = args.country or countryModule[state]
	
	return country
end

local function countries(args)
	if not country(args) then
		if args.countries then
			return "no"
		end
	elseif country(args) == 'EUR' or country(args) == 'AFRICA' or country(args) == 'ASIA' or country(args) == 'SAD' then
		if args.countries then
			return "no"
		end
	end
end

local function states(args)
	if country(args) == 'BRA' or country(args) == 'MEX' then
		if args.areas or args.borough or args.boroughs or args.cantons or args.communes or args.communities or args.countries or args.county or args.departments or args.districts or args.divisions or args.federal_cities or args.governorates or args.indep_city or args.indep_cities or args.island or args.krais or args.label1 or args.label2 or args.label3 or args.label4 or args.label5 or args.lga or args.location1 or args.location2 or args.location3 or args.location4 or args.location5 or args.locations or args.municipality or args.oblasts or args.okrugs or args.parish or args.parishes or args.prefectures or args.provinces or args.regions or args.republics or args.rural_municipalities or args.sheadings or args.subcounties or args.subprefectures or args.subregions or args.territories then
			return "yes"
		else
			return "no"
		end
	end
end

local function australia(args)
	if country(args) == 'AUS' then
		if args.areas or args.borough or args.boroughs or args.cantons or args.communes or args.communities or args.counties or args.countries or args.county or args.departments or args.districts or args.divisions or args.federal_cities or args.governorates or args.indep_city or args.indep_cities or args.island or args.krais or args.label1 or args.label2 or args.label3 or args.label4 or args.label5 or args.location1 or args.location2 or args.location3 or args.location4 or args.location5 or args.municipalities or args.municipality or args.oblasts or args.okrugs or args.parish or args.parishes or args.prefectures or args.provinces or args.regions or args.republics or args.rural_municipalities or args.sheadings or args.subcounties or args.subprefectures or args.subregions or args.territories then
			return "yes"
		else
			return "no"
		end
	end
end

local function canada(args)
	if country(args) == 'CAN' then
		if args.borough or args.boroughs or args.cantons or args.communes or args.countries or args.departments or args.federal_cities or args.governorates or args.indep_city or args.indep_cities or args.island or args.krais or args.label1 or args.label2 or args.label3 or args.label4 or args.label5 or args.lga or args.location1 or args.location2 or args.location3 or args.location4 or args.location5 or args.locations or args.oblasts or args.okrugs or args.prefectures or args.republics or args.sheadings or args.states or args.subcounties or args.subprefectures or args.subregions then
			return "yes"
		else
			return "no"
		end
	end
end

local function china(args)
	if country(args) == 'CHN' then
		if args.areas or args.borough or args.boroughs or args.cantons or args.communes or args.communities or args.countries or args.departments or args.divisions or args.federal_cities or args.governorates or args.indep_city or args.indep_cities or args.island or args.krais or args.label1 or args.label2 or args.label3 or args.label4 or args.label5 or args.lga or args.location1 or args.location2 or args.location3 or args.location4 or args.location5 or args.locations or args.municipalities or args.municipality or args.oblasts or args.okrugs or args.parish or args.parishes or args.prefectures or args.republics or args.rural_municipalities or args.sheadings or args.states or args.subcounties or args.subprefectures or args.subregions or args.territories then
			return "yes"
		else
			return "no"
		end
	end
end

local function france(args)
	if country(args) == 'FRA' then
		if args.areas or args.borough or args.boroughs or args.cantons or args.communes or args.communities or args.counties or args.countries or args.county or args.districts or args.divisions or args.federal_cities or args.governorates or args.indep_city or args.indep_cities or args.island or args.krais or args.label1 or args.label2 or args.label3 or args.label4 or args.label5 or args.lga or args.location1 or args.location2 or args.location3 or args.location4 or args.location5 or args.locations or args.municipalities or args.municipality or args.oblasts or args.okrugs or args.parish or args.parishes or args.prefectures or args.provinces or args.republics or args.rural_municipalities or args.sheadings or args.states or args.subcounties or args.subprefectures or args.subregions or args.territories then
			return "yes"
		else
			return "no"
		end
	end
end

local function india(args)
	if country(args) == 'IND' then
		if args.areas or args.borough or args.boroughs or args.cantons or args.communes or args.communities or args.counties or args.countries or args.county or args.departments or args.divisions or args.federal_cities or args.governorates or args.indep_city or args.indep_cities or args.island or args.krais or args.label1 or args.label2 or args.label3 or args.label4 or args.label5 or args.lga or args.location1 or args.location2 or args.location3 or args.location4 or args.location5 or args.locations or args.oblasts or args.okrugs or args.parish or args.parishes or args.prefectures or args.provinces or args.regions or args.republics or args.rural_municipalities or args.sheadings or args.subcounties or args.subprefectures or args.subregions then
			return "yes"
		else
			return "no"
		end
	end
end

local function netherlands(args)
	if country(args) == 'NLD' then
		if args.areas or args.borough or args.boroughs or args.cantons or args.communes or args.communities or args.counties or args.countries or args.county or args.departments or args.districts or args.divisions or args.federal_cities or args.governorates or args.indep_city or args.indep_cities or args.island or args.krais or args.label1 or args.label2 or args.label3 or args.label4 or args.label5 or args.lga or args.location1 or args.location2 or args.location3 or args.location4 or args.location5 or args.locations or args.oblasts or args.okrugs or args.parish or args.parishes or args.prefectures or args.regions or args.republics or args.rural_municipalities or args.sheadings or args.states or args.subcounties or args.subprefectures or args.subregions or args.territories then
			return "yes"
		else
			return "no"
		end
	end
end

local function russia(args)
	if country(args) == 'RUS' then
		if args.areas or args.borough or args.boroughs or args.cantons or args.communes or args.communities or args.counties or args.countries or args.county or args.departments or args.districts or args.divisions or args.governorates or args.indep_city or args.indep_cities or args.island or args.label1 or args.label2 or args.label3 or args.label4 or args.label5 or args.lga or args.location1 or args.location2 or args.location3 or args.location4 or args.location5 or args.locations or args.municipalities or args.municipality or args.parish or args.parishes or args.prefectures or args.provinces or args.regions or args.rural_municipalities or args.sheadings or args.states or args.subcounties or args.subprefectures or args.subregions or args.territories then
			return "yes"
		else
			return "no"
		end
	end
end

local function spain(args)
	if country(args) == 'ESP' then
		if args.areas or args.borough or args.boroughs or args.cantons or args.communes or args.counties or args.countries or args.county or args.departments or args.districts or args.divisions or args.federal_cities or args.governorates or args.indep_city or args.indep_cities or args.island or args.krais or args.label1 or args.label2 or args.label3 or args.label4 or args.label5 or args.lga or args.location1 or args.location2 or args.location3 or args.location4 or args.location5 or args.locations or args.municipalities or args.municipality or args.oblasts or args.okrugs or args.parish or args.parishes or args.prefectures or args.regions or args.republics or args.rural_municipalities or args.sheadings or args.states or args.subcounties or args.subprefectures or args.subregions or args.territories then
			return "yes"
		else
			return "no"
		end
	end
end

local function unitedKingdom(args)
	if country(args) == 'GBR' then
		if args.borough or args.cantons or args.communes or args.communities or args.countries or args.county or args.departments or args.divisions or args.federal_cities or args.governorates or args.indep_city or args.indep_cities or args.krais or args.label1 or args.label2 or args.label3 or args.label4 or args.label5 or args.lga or args.location1 or args.location2 or args.location3 or args.location4 or args.location5 or args.locations or args.municipalities or args.municipality or args.oblasts or args.okrugs or args.parish or args.prefectures or args.provinces or args.regions or args.republics or args.rural_municipalities or args.states or args.subcounties or args.subprefectures or args.subregions or args.territories then
			return "yes"
		else
			return "no"
		end
	end
end

local function unitedStates(args)
	if country(args) == 'USA' then
		if args.areas or args.cantons or args.cities  or args.communes or args.communities or args.countries or args.departments or args.destinations or args.districts or args.divisions or args.federal_cities or args.governorates or args.island or args.krais or args.label1 or args.label2 or args.label3 or args.label4 or args.label5 or args.lga or args.location1 or args.location2 or args.location3 or args.location4 or args.location5 or args.locations or args.oblasts or args.okrugs or args.photo or args.prefectures or args.provinces or args.regions or args.republics or args.rural_municipalities or args.sheadings or args.subcounties or args.subprefectures or args.subregions or args.territories or args.towns or args.villages then
			return "yes"
		else
			return "no"
		end
	end
end

local function trigger(args)
	if countries(args) == 'yes' or states(args) == 'yes' or australia(args) == 'yes' or canada(args) == 'yes' or china(args) == 'yes' or france(args) == 'yes' or india(args) == 'yes' or netherlands(args) == 'yes' or russia(args) == 'yes' or spain(args) == 'yes' or unitedKingdom(args) == 'yes' or unitedStates(args) == 'yes' then
		return true
	else
		return false
	end
end

function p.errors(frame)
	local args = getArgs(frame)
	local pagename = frame:getTitle()
	
	if trigger(args) == true then
		return string.format("[[Category:Infobox road transclusion errors|%% %s]]", pagename)
	else
		return nil
	end
end

return p


--args.areas or args.borough or args.boroughs or args.cantons or args.communes or args.communities or args.counties or args.countries or args.county or args.departments or args.districts or args.divisions or args.federal_cities or args.governorates or args.indep_city or args.indep_cities or args.island or args.krais or args.label1 or args.label2 or args.label3 or args.label4 or args.label5 or args.lga or args.location1 or args.location2 or args.location3 or args.location4 or args.location5 or args.locations or args.municipalities or args.municipality or args.oblasts or args.okrugs or args.parish or args.parishes or args.prefectures or args.provinces or args.regions or args.republics or args.rural_municipalities or args.sheadings or args.states or args.subcounties or args.subprefectures or args.subregions or args.territories then

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.