« Module:Country data » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| Ligne 18 : | Ligne 18 : | ||
local modul = modulelist[mw.ustring.lower(country or '')] | local modul = modulelist[mw.ustring.lower(country or '')] | ||
if not modul then | if not modul then | ||
return country | return country | ||
end | end | ||
if not typeval then | if not typeval then | ||
| Ligne 34 : | Ligne 34 : | ||
flag = '' | flag = '' | ||
end | end | ||
return flag .. ' [[' .. link.. '|' .. name .. ']]' | return flag .. ' [[' .. link.. '|' .. name .. ']]' , true -- true indicates success here | ||
end | end | ||
return p | return p | ||
Version du 15 janvier 2015 à 16:32
local p = {} local modulelist = mw.loadData('Module:Country data/liste')
local function getval(info, param, data) -- info== name, flag, etc. -- param = ancient, default, etc. -- data = table module with the data if not data or not data[info] then return nil end if type(data[info]) == 'string' then return data[info] end return data[info][param] end
function p.standarddisplay(country, typeval) local modul = modulelist[mw.ustring.lower(country or )] if not modul then return country end if not typeval then typeval = "default" end local data = require('Module:Country data/' .. modul) local function get(what) return getval(what, typeval, data) end local name = get('shortname') or get('name') local link = get('link') or name local flag = get('flag')
if flag then flag = '' .. '22x20px' else flag = end return flag .. ' ' .. name .. '' , true -- true indicates success here end return p