(Created page with "local List = {} function List.make(arr) local container = mw.html.create('div') local sponsorList = mw.text.split(arr, ',') for i, v in ipairs(sponsorList) do v = mw.text.trim(v) local pageExists = mw.getCurrentFrame():callParserFunction('#ifexist', v, 'yes', 'no' ) local div = mw.html.create('div') if ( pageExists == 'yes' ) then div:wikitext('' .. v .. '') else div:wikitext(v) end container:node(div) end return container e...") |
No edit summary |
||
Line 3: | Line 3: | ||
function List.make(arr) | function List.make(arr) | ||
local container = mw.html.create('div') | local container = mw.html.create('div') | ||
local | local array = mw.text.split(arr, ',') | ||
for i, v in ipairs( | for i, v in ipairs(array) do | ||
v = mw.text.trim(v) | v = mw.text.trim(v) | ||
local pageExists = mw.getCurrentFrame():callParserFunction('#ifexist', v, 'yes', 'no' ) | local pageExists = mw.getCurrentFrame():callParserFunction('#ifexist', v, 'yes', 'no' ) |
Revision as of 16:45, 30 August 2022
Documentation for this module may be created at Module:Infobox/Widget/List/doc
local List = {}
function List.make(arr)
local container = mw.html.create('div')
local array = mw.text.split(arr, ',')
for i, v in ipairs(array) do
v = mw.text.trim(v)
local pageExists = mw.getCurrentFrame():callParserFunction('#ifexist', v, 'yes', 'no' )
local div = mw.html.create('div')
if ( pageExists == 'yes' ) then
div:wikitext('[[' .. v .. '|' .. v .. ']]')
else
div:wikitext(v)
end
container:node(div)
end
return container
end
return List