Modul:Flaggen

Die Dokumentation für dieses Modul kann unter Modul:Flaggen/Doku erstellt werden

local p = {}
local full = mw.loadData('Modul:Flaggen/Alias');
local getArgs = require('Modul:Arguments').getArgs

local function flag(code)
	local a = full.info[code] or code
	local flag = mw.loadData('Modul:Flaggen/'..string.sub(a, 1, 1)).info[a]
	if flag == nil then return 'Datei:Flag of None.svg' else
	return 'Datei:'..flag[1]
	end
end

local function land(code)
	local a = full.info[code] or code
	local land = mw.loadData('Modul:Flaggen/'..string.sub(a, 1, 1)).info[a]
	if land == nil then return a else
	return land[2]
	end
end

local function artikel(code)
	local a = full.info[code] or code
	local artikel = mw.loadData('Modul:Flaggen/'..string.sub(a, 1, 1)).info[a]
	if artikel == nil then return flag(a) else
	if artikel[3] == nil then return flag(a) else
	return 'Flagge '..artikel[3]
	end end
end

function p.staat(frame) -- SUPPORT Modul:Partei/Liste
	local args = getArgs(frame)
	return land(args[1])
end

function p.flagge(frame)
	local args = getArgs(frame)
	local a = args[1]
	local b = args[2]
	local c = args[3]
	local f = args['f']
	local n = args['n']
	local w = args['w'] or '30'
	if b then
		if b == 'f' then return '[['..flag(a).. '|' ..w..'px|link='..artikel(a)..']]' else
		if c then
			if c == 'n' then return '[['..flag(a).. '|' ..w..'px]] [['..land(a)..'|'..b..']]' else
			return '[['..flag(a).. '|' ..w..'px]] [['..c..'|'..b..']]' end else
		return '[[' ..flag(a).. '|' ..w..'px]] [['..b..']]' end end
	else
	if n then return '[[' ..flag(a).. '|' ..w..'px]] [['..n..'|'..land(a)..']]' end end
	if f then
		if f == 'n' then return '[[' ..flag(a).. '|' ..w..'px|link='..land(a)..']]' else
		return '[[' ..flag(a).. '|' ..w..'px|link='..f..']]' end end
	return '[[' ..flag(a).. '|' ..w..'px]] [['..land(a)..']]'
end

function p.tabelle(frame)
	local args = getArgs(frame)
	local buchstabe = args['buchstabe']
	local cfg = mw.loadData('Modul:Flaggen/'..buchstabe)
	local root = mw.html.create('table'):addClass('wikitable sortable')
	root:tag('tr')
		:tag('th'):wikitext('Code'):done()
		:tag('th'):wikitext('Flag'):done()
		:tag('th'):wikitext('Land'):done()
	for code, value in pairs(cfg.info) do
	root:tag('tr')
		:tag('td'):wikitext('' .. code .. ''):done()
		:tag('td'):wikitext('[[Datei:' .. value[1] .. '|30px]]'):done()
		:tag('td'):wikitext('[[' .. value[2] ..']]'):done()
	end
	return root
end

function p.alias(frame)
	local root = mw.html.create('table'):addClass('wikitable sortable')
	root:tag('tr')
		:tag('th'):wikitext('Staat-Land'):done()
		:tag('th'):wikitext('Code'):done()
	local alln = {}
	for k, v in pairs(full.info) do
		alln[#alln+1] = k
	end
	table.sort(alln)
	for _, code in ipairs(alln) do
	root:tag('tr')
		:tag('td'):wikitext('[[' .. code .. ']]'):done()
		:tag('td'):wikitext(full.info[code]):done()
	end
	return root
end

return p

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.