Modul:Flaggen
Erscheinungsbild
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 a 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 b = args[2]
local w = args['w'] or '30'
local t = args['t']
local l = args['l']
if b == 'j' then return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..land(args[1])..']]'
elseif t then return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..t..']]'
elseif l then return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..land(args[1])..'|'..l..']]'
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/'..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
return p