Module:Infobox/Widget/Sponsors: Difference between revisions

From TwogPedia
No edit summary
No edit summary
Line 1: Line 1:
local Sponsors = {}
local Sponsors = {}


function Sponsors.make(sponsorArr)
function Sponsors.make(results)
local container = mw.html.create('div')
local container = mw.html.create('div')
local sponsorList = mw.text.split(sponsorArr, ',')
for i, v in ipairs(sponsorList) do
for r = 1, #results do
v = mw.text.trim(v)
local result = results[r]
local pageExists = mw.getCurrentFrame():callParserFunction('#ifexist', v, 'yes', 'no' )
        local sponsor = mw.html.create('li')
local div = mw.html.create('div')
        :wikitext('[[' .. result._pageName .. ']]')
if ( pageExists == 'yes' ) then
        if result.startRef then
div:wikitext('[[' .. v .. '|' .. v .. ']]')
        local startRefName = result.startRefName or ''
else
        sponsor:wikitext(frame:preprocess('<ref name='.. startRefName .. '>' ..result.startRef .. '</ref>'))
div:wikitext(v)
        end
end
        container:node(sponsor)
container:node(div)
    end
end


return container
return container
end
end


return Sponsors
return Sponsors

Revision as of 13:31, 26 September 2022

Documentation for this module may be created at Module:Infobox/Widget/Sponsors/doc

local Sponsors = {}

function Sponsors.make(results)
	local container = mw.html.create('div')
	
	for r = 1, #results do
		local result = results[r]
        local sponsor = mw.html.create('li')
        	:wikitext('[[' .. result._pageName .. ']]')
        if result.startRef then
        	local startRefName = result.startRefName or ''
        	sponsor:wikitext(frame:preprocess('<ref name='.. startRefName .. '>' ..result.startRef .. '</ref>'))
        end
        container:node(sponsor)
    end

	return container
end

return Sponsors