„Modul:Flaggen“ – Versionsunterschied
Erscheinungsbild
[gesichtete Version] | [gesichtete Version] |
Inhalt gelöscht Inhalt hinzugefügt
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 28: | Zeile 28: | ||
local a = args[1] |
local a = args[1] |
||
local b = args[2] |
local b = args[2] |
||
⚫ | |||
local w = args['w'] or '30' |
local w = args['w'] or '30' |
||
⚫ | |||
local l = args['l'] |
local l = args['l'] |
||
if b == 'j' then return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..land(args[1])..']]' |
if b then |
||
if b == 'j' then return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..land(args[1])..']]' |
|||
elseif c then return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..c..'|'..b..']]' |
|||
else return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..land(args[1])..'|'..b..']]' end |
|||
else |
|||
⚫ | |||
if l then return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..l..']]' |
|||
⚫ | |||
end |
end |
||
Version vom 2. Oktober 2023, 17:58 Uhr
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 'Empty flag.svg' else
return 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
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 w = args['w'] or '30'
local l = args['l']
if b then
if b == 'j' then return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..land(args[1])..']]'
elseif c then return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..c..'|'..b..']]'
else return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..land(args[1])..'|'..b..']]' end
else
if l then return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]] [['..l..']]'
else return '[[Datei:' ..flag(args[1]).. '|' ..w..'px]]' end 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
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