Modul:Flaggen

Dies ist eine Version, die am 2. Oktober 2023 gesichtet wurde. Neue Änderungen könnten seitdem vorgenommen worden sein.

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

local p = {}
local getArgs = require('Modul:Arguments').getArgs

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

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

function p.staat(frame)
	local args = getArgs(frame)
	return land(args[1])
end

function p.flagge(frame)
	local args = getArgs(frame)
	local a = args[1]
	local w = args[2] or '30'
	local V = args['V']
	local t = args['t']
	if V == '1' then return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..land(args[1])..']]'
	elseif V == '2' then return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..t..']]'
	elseif V == '3' then return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..land(args[1])..'|'..t..']]'
	else return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]]' end
end

function p.tabelle(frame)
	local args = getArgs(frame)
	local buchstabe = args['buchstabe']
	local cfg = mw.loadData('Modul:Flaggen/'..letter)
	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

return p