Module:Sandbox/Gonnym/Localdata

Revision as of 22:40, 23 March 2019 by imported>Gonnym
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Sandbox/Gonnym/Localdata/doc

local localData = {}

local frame = mw.getCurrentFrame()
local parent = frame:getParent() or frame
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 = parent:getTitle() -- in case it is different from the name of the module
localData.moduleName = frame.args.nom

-- load wikidata item:
local wikidata = require('Module:Wikidata')
localData.item = wikidata.getEntity(localData.wikidata)

return localData