Jump to content

Module:CountryData/cacheC

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by GKFX (talk | contribs) at 19:22, 3 May 2021 (Add loadData-compatible modules to cache the content of the most-used country data). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local CountryData = require('Module:CountryData')
local redirects = {CYP='Cyprus', CZE='Czech Republic', CMR='Cameroon', CAN='Canada', CPV='Cape Verde', CAF='Central African Republic', CHL='Chile', CHN='China', COL='Colombia', COM='Comoros', COD='Democratic Republic of the Congo', COK='Cook Islands', CRI='Costa Rica', CIV='Ivory Coast', CUB='Cuba', CHE='Switzerland', CRO='Croatia', CHI='Chile', CAY='Cayman Islands', CSK='Czechoslovakia', CH='Switzerland', CGO='Republic of the Congo', CHA='Chad', CRC='Costa Rica', CUR='Curaçao', CAM='Cambodia', CTA='Central African Republic', CSA='Confederate States of America', CIS='Commonwealth of Independent States', CUW='Curaçao', ['Cote d\'Ivoire']='Ivory Coast', Congo='Republic of the Congo', ['Congo DR']='Democratic Republic of the Congo', Czech='Czech Republic', ['Collectivity of Saint Martin']='Saint Martin', ['Confederate States']='Confederate States of America', ['Côte d\'Ivoire']='Ivory Coast', Crimea='Autonomous Republic of Crimea'}
local pages = {'Christmas Island', 'Connecticut', 'Community of Madrid', 'Cascadia', 'Curaçao', 'Chad', 'Chechen Republic of Ichkeria', 'Ceylon', 'Confederate States of America', 'Canada', 'Chihuahua', 'Castilla–La Mancha', 'Chechnya', 'Cumbria', 'Comoros', 'Chile', 'Colombia', 'Cape Verde', 'Catalonia', 'Czech Republic', 'California', 'Czechoslovakia', 'Cayman Islands', 'Croatia', 'Cyprus', 'Commonwealth of Independent States', 'Cuba', 'Calgary', 'Cook Islands', 'Cantabria', 'Chinese Taipei', 'Colorado', 'China', 'Cameroon', 'Cheshire', 'Castile and León', 'Cambodia', 'Cornwall', 'Cocos (Keeling) Islands', 'Costa Rica', 'Canary Islands', 'Chicago', 'Central African Republic'}
local p = {
	redirects = redirects,
	data = {}
}
local frame = mw.getCurrentFrame()

for _,v in ipairs(pages) do
	p.data[v] = CountryData.gettable(frame, v, {})
end

return p