Difference between revisions of "Module:Display"
Jump to navigation
Jump to search
m (6 revisions imported: Importing from localhost) |
Tag: Reverted |
||
Line 17: | Line 17: | ||
innerData = mw.text.split(v, ',') | innerData = mw.text.split(v, ',') | ||
innerFrame = mw.html.create('span') | innerFrame = mw.html.create('span') | ||
innerFrame:wikitext('[[file:' .. innerData[1] .. | innerFrame:wikitext(--'[[file:' .. innerData[1] .. | ||
'|50px|frameless]] - ' .. innerData[2]) | --'|50px|frameless]] - ' .. | ||
innerData[2]) | |||
innerResult = innerResult .. tostring(innerFrame) | innerResult = innerResult .. tostring(innerFrame) | ||
end | end |
Revision as of 16:18, 1 December 2021
Documentation for this module may be created at Module:Display/doc
--<nowiki> local p = {} local com = require( 'Module:Common' ) function gridIconList(data, cols) result = '' if com.exists(data) then data = mw.text.split(data, '\n') result = mw.html.create('div') result:addClass('Icon-Text-Grid') if cols ~= nil and cols ~= '' then result:addClass('Icon-Grid-Cols-' .. cols) end innerResult = '' for k, v in ipairs(data) do if v ~= nil and v ~= '' then innerData = mw.text.split(v, ',') innerFrame = mw.html.create('span') innerFrame:wikitext(--'[[file:' .. innerData[1] .. --'|50px|frameless]] - ' .. innerData[2]) innerResult = innerResult .. tostring(innerFrame) end end result:wikitext(innerResult) end return result end function p.gridIconList(frame) return gridIconList(frame.args[1], frame.args['cols']) end return p