Module:Counties of Norway

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Lua

CodeDiscussionEditHistoryLinksLink count Subpages:DocumentationTestsResultsSandboxLive code All modules


Usage

[edit]

Template:Counties of Norway uses:

{{#invoke:Countries|main|Module:Counties of Norway|simple=yes}}
  • {{Counties of Norway|prefix=:Category:}} gives:


Template:Counties of Norway historical uses:

{{#invoke:Countries|main|Module:Counties of Norway}}
  • {{Counties of Norway historical|prefix=:Category:}} gives:

See also

[edit]


Code

--[=[
Data defining countries for {{#invoke:Countries|main|Module:Counties of Norway}}.

Output is pattern after making these substitutes:
{lang}		User's language from {{int:lang}} such as 'en' or 'de'.
{dir}		Language direction 'ltr' or 'rtl'.
{colon}		Language equivalent of ": " from {{colon|lang}}.
{XYZtitle}	Title for lang from XYZ section of defined titles.
{XYZlist}	List of countries for lang from XYZ section of defined lists.
			XYZ must consist of en alphabetic characters [A-Za-z].
]=]
return {
	titles = {
		main = {
			en = 'Counties of Norway',
			nb = 'Norske fylker',
			nn = 'Norske fylke',
			no = 'Norske fylker',
		},
		former = {
			en = 'Former counties of Norway',
			nb = 'Tidligere norske fylker',
			nn = 'Tidlegare norske fylke',
			no = 'Tidligere norske fylker',
		},
		other = {
			en = 'Other territories and dependencies',
			nb = 'Andre områder og biland',
			nn = 'Andre område og biland',
			no = 'Andre områder og biland',
		},
	},
	pattern = {
		{	'<div lang="{lang}" dir="{dir}" class="catlinks" ' ..
			' style="clear:none;display:table;box-sizing:border-box;font-size:88%;line-height:normal;margin:2px 0;padding:2px"><div style="display:table-cell>[[File:Flag of Norway.svg|20px]]&nbsp;',
				'mainlist',
				'formerlist',
				'otherlist',
		},
		{	'<em>{maintitle}{colon}</em>',
				{ 'maintitle', 'mainlist', },
		},
			'{mainlist}',
		{	'<br />',
				{ 'mainlist', 'formerlist', },
				{ 'mainlist', 'otherlist', },
		},
		{	'<em>{formertitle}{colon}</em>',
				{ 'formertitle', 'formerlist', },
		},
			'{formerlist}',
		{	'<br />',
				{ 'formerlist', 'otherlist', },
		},
		{	'<em>{othertitle}{colon}</em>',
				{ 'othertitle', 'otherlist', },
		},
			'{otherlist}',
		{	'</div></div>',
				'mainlist',
				'formerlist',
				'otherlist',
		},
	},
	simple = {
		pattern = {
			{	'<div lang="{lang}" dir="{dir}" class="catlinks"' ..
				' style="clear:none;display:table;box-sizing:border-box;font-size:88%;line-height:normal;margin:2px 0;padding:2px"><div style="display:table-cell">[[File:Flag of Norway.svg|20px]]&nbsp;',
					'mainlist',
					'otherlist',
			},
			{	'<em>{maintitle}{colon}</em>',
					{ 'maintitle', 'mainlist', },
			},
				'{mainlist}',
			{	'&nbsp;– ',
					{ 'mainlist', 'otherlist', },
			},
			{	'<em>{othertitle}{colon}</em>',
					{ 'othertitle', 'otherlist', },
			},
				'{otherlist}',
			{	'</div></div>',
					'mainlist',
					'otherlist',
			},
		},
		sections = {
			main = {
			},
			other = {
			},
		},
	},
	lists = {
		main = {
			automatic   = '42 32 33 56 34 15 18 03 11 40 55 50 39 46 31',
			default     = 'automatic sorted', -- this applies with uselang=XX where XX is not defined here
			english     = '42 32 33 56 34 15 18 03 31 11 40 55 50 39 46', -- this applies with uselang=en
			da          = 'automatic',
			fi          = 'automatic',
			fo          = 'automatic',
			is          = 'automatic',
			nb          = 'automatic',
			nn          = 'automatic',
			no          = 'automatic',
			sv          = 'automatic',
		},
		former = {
			automatic   = '09 13 04 12 17 05 14 16 54 10 38 30',
			default     = 'automatic sorted', -- this applies with uselang=XX where XX is not defined here
			english     = 'automatic', -- this applies with uselang=en
		},
		other = {
			automatic   = 'BV 22 NQ XP1 21',
			default     = 'automatic sorted', -- this applies with uselang=XX where XX is not defined here
			english     = 'automatic', -- this applies with uselang=en
		},
	},
	countries = {
		--	Numerical codes are from ISO 3166-2:NO, supplemented by new codes for the 2024 reform.
		--	BV, NQ and SJ are ISO 3166-1 codes (NQ was only valid 1974-1983).
		--	XP1 is invented for use in this module only.
	--	['01'] = ['31']  (Østfold until 2019)
	--	['02'] = ['32']  (Akershus until 2019)
		['03'] = { 'Oslo',                    qid = 'Q585', },
		['04'] = { 'Hedmark',                 qid = 'Q50616', note = '<small>(–2019)</small>', },
		['05'] = { 'Oppland',                 qid = 'Q50617', note = '<small>(–2019)</small>', },
	--	['06'] = ['33']  (Buskerud until 2019)
	--	['07'] = ['39']  (Vestfold until 2019)
	--	['08'] = ['40']  (Telemark until 2019)
		['09'] = { 'Aust-Agder',              qid = 'Q50621', note = '<small>(–2019)</small>', },
		['10'] = { 'Vest-Agder',              qid = 'Q50623', note = '<small>(–2019)</small>', },
		['11'] = { 'Rogaland',                qid = 'Q50624', },
		['12'] = { 'Hordaland',               qid = 'Q50625', note = '<small>(–2019)</small>', },
		['13'] = { 'Bergen, Norway',          qid = 'Q26793', note = '<small>(–1971)</small>', },
		['14'] = { 'Sogn og Fjordane',        qid = 'Q50626', note = '<small>(–2019)</small>', },
		['15'] = { 'Møre og Romsdal',         qid = 'Q50627', },
		['16'] = { 'Sør-Trøndelag',           qid = 'Q50628', note = '<small>(–2017)</small>', },
		['17'] = { 'Nord-Trøndelag',          qid = 'Q50629', note = '<small>(–2017)</small>', },
		['18'] = { 'Nordland',                qid = 'Q50630', },
	--	['19'] = ['55']  (Troms until 2019)
	--	['20'] = ['56']  (Finnmark until 2019)
		['21'] = { 'Svalbard',                qid = 'Q25231', },
		['22'] = { 'Jan Mayen',               qid = 'Q14056', },
	--	['23'] = ['50']  (Trøndelag 2018–2019)
		['30'] = { 'Viken (county)', 'Viken', qid = 'Q56407178', note = '<small>(2020–2023)</small>', },
		['31'] = { 'Østfold',                 qid = 'Q50614', },
		['32'] = { 'Akershus',                qid = 'Q50615', },
		['33'] = { 'Buskerud',                qid = 'Q50618', },
		['34'] = { 'Innlandet',               qid = 'Q56404886', },
		['38'] = { 'Vestfold og Telemark',    qid = 'Q56405721', note = '<small>(2020–2023)</small>', },
		['39'] = { 'Vestfold',                qid = 'Q50619', },
		['40'] = { 'Telemark',                qid = 'Q2254', },
		['42'] = { 'Agder',                   qid = 'Q2729021', },
		['46'] = { 'Vestland',                qid = 'Q56407177', },
		['50'] = { 'Trøndelag',               qid = 'Q127676', },
		['54'] = { 'Troms og Finnmark',       qid = 'Q52600648', note = '<small>(2020–2023)</small>', },
		['55'] = { 'Troms',                   qid = 'Q50631', },
		['56'] = { 'Finnmark',                qid = 'Q50632', },
		['BV'] = { 'Bouvet Island',           qid = 'Q23408', },
		['NQ'] = { 'Dronning Maud Land',      qid = 'Q189999', },
		['SJ'] = { 'Svalbard and Jan Mayen',  qid = 'Q842829', },
		['XP1'] = { 'Peter I Island',         qid = 'Q202780', },
	},
}