« Module:Infobox/Localdata » : différence entre les versions

De Lagny-sur-Marne Wiki
Aller à la navigation Aller à la recherche
0x010D (discussion | contributions)
Module destiné à supprimer les variables globales de Module:Infobox
(Aucune différence)

Version du 12 septembre 2016 à 05:05

local localdata = {}

local frame = mw.getCurrentFrame() local modulename = frame.args.nom local parent = frame:getParent() local templatename = parent:getTitle() -- au cas où il soit différent du nom du module local params = parent.args

-- fill-up global variable localdata using params for i, j in pairs(params) do if j and mw.text.trim(j) ~= then -- empty parameters are ignored localdata[i] = j end end localdata.templatename = templatename or modulename

-- load wikidata item as a global variable: if localdata.wikidata ~= '-' then localdata.item = wikidata.getEntity(localdata.wikidata) end

return localdata