Module:Sponsors: Difference between revisions

From TwogPedia
No edit summary
mNo edit summary
Line 10: Line 10:
local values = mw.text.jsonDecode(value)
local values = mw.text.jsonDecode(value)
local sponsor = mw.html.create('div')
local sponsor = mw.html.create('div')
:wikitext('[[' .. values.id .. ']]')
:wikitext('[[Companies/' .. values.id .. ']]')
if values.startRef then  
if values.startRef then  
local startRefName = values.startRefName or ''
local startRefName = values.startRefName or ''

Revision as of 11:57, 13 June 2023

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

local getArgs = require('Module:Arguments').getArgs

local Sponsors = {}

function Sponsors.main(frame)
	local args = getArgs(frame)
	local sponsorList = ''
	local list = mw.html.create('div')
	for key, value in ipairs (args) do
		local values = mw.text.jsonDecode(value)
		local sponsor = mw.html.create('div')
			:wikitext('[[Companies/' .. values.id .. ']]')
		if values.startRef then 
			local startRefName = values.startRefName or ''
	    	sponsor:wikitext(frame:preprocess('<ref name='.. startRefName .. '>' ..values.startRef .. '</ref>'))
		end
		list:node(sponsor)
	end
	return list
end

return Sponsors