Module:Display

From Foundation - Wiki
Revision as of 11:53, 10 October 2021 by Sakaratte (talk | contribs) (Created page with "local p = {} function gridIconList(data) result = '' if data ~= nil and data ~= '' then data = mw.text.split(data, '\n') result = mw.html.create('div') result:addClas...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Display/doc

local p = {}

function gridIconList(data)
	result = ''
	if data ~= nil and data ~= '' then
		data = mw.text.split(data, '\n')
		result = mw.html.create('div')
		result:addClass('Icon-Text-Grid')
		innerResult = ''
		for k, v in ipairs(data) do
			innerData = mw.text.split(v, ',')
			innerFrame = mw.html.create('span')
			innerFrame:wikitext('[[file:' .. innerData[1] .. ']] - ' .. innerData[2])
			innerResult = innerResult .. tostring(innerFrame)
		end
		result:wikitext(innerResult)
	end
	return result
end

function p.gridIconList(frame)
	return gridIconList(frame.args[1])
end

return p