Jump to content

Module:CountryData/cacheS

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by GKFX (talk | contribs) at 19:25, 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 = {SRB='Serbia', SVK='Slovakia', SVN='Slovenia', SWE='Sweden', SLV='El Salvador', SEN='Senegal', SGP='Singapore', SAU='Saudi Arabia', SOM='Somalia', SWZ='Eswatini', SYR='Syria', SUR='Suriname', SCG='Serbia and Montenegro', SMR='San Marino', STP='São Tomé and Príncipe', SLE='Sierra Leone', SUI='Switzerland', ['SFR Yugoslavia']='Yugoslavia', SUD='Sudan', SRI='Sri Lanka', SCO='Scotland', SER='Serbia', SEY='Seychelles', SIN='Singapore', SKN='Saint Kitts and Nevis', SLO='Slovenia', SCA='Kalmar Union', SAM='Samoa', SOL='Solomon Islands', SMOM='Sovereign Military Order of Malta', SWI='Switzerland', SAF='South Africa', SK='Saskatchewan', SSD='South Sudan', SL='Sri Lanka', SA='South Africa', SPA='Spain', ['Sao Tome and Principe']='São Tomé and Príncipe', ['Syrian National Coalition']='Syrian opposition'}
local pages = {'Saint Lucia', 'São Paulo', 'São Tomé and Príncipe', 'South Sudan', 'Spanish Empire', 'Seychelles', 'Sabah', 'Somalia', 'Saint Barthélemy', 'Saint Kitts and Nevis', 'Sierra Leone', 'Sri Lanka', 'San Marino', 'Samoa', 'Sudan', 'Saxony', 'South Ossetia', 'Slovenia', 'South Georgia and the South Sandwich Islands', 'Swaziland', 'Saint Pierre and Miquelon', 'Saint Martin', 'Sweden', 'Spain', 'Southern Rhodesia', 'San Francisco', 'Santa Catarina', 'Suriname', 'Switzerland', 'Sint Maarten', 'Syria', 'Selangor', 'Scotland', 'South Carolina', 'Shropshire', 'South Korea', 'Syrian opposition', 'Serbia and Montenegro', 'Saint Vincent and the Grenadines', 'South Dakota', 'Slovakia', 'South Australia', 'Senegal', 'Saudi Arabia', 'South Yemen', 'Soviet Union', 'Sicily', 'Singapore', 'Saint Helena, Ascension and Tristan da Cunha', 'Sarawak', 'Solomon Islands', 'Svalbard and Jan Mayen', 'Somerset', 'Somaliland', 'Serbia', 'South Vietnam', 'South Africa', 'Saint Helena', 'Sahrawi Arab Democratic Republic', 'Sovereign Military Order of Malta', 'Sealand', 'Saskatchewan'}
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