Module:Infobox/Widget/Role

From TwogPedia
Revision as of 21:32, 31 August 2022 by Couchor (talk | contribs) (Created page with "local Role = {} function Role.make(rowName, value, game) value = string.upper(value) local container = mw.html.create('div') :addClass('ib-row') local name = mw.html.create('div') :addClass('ib-rowName') :wikitext(rowName .. ': ') local valueNode = mw.html.create('div') -- If no game then return value without link if game == nil then return container:node(name):node(valueNode:wikitext(value)) end local catName,visibleName if value == 'COACH'...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local Role = {}

function Role.make(rowName, value, game)
	value = string.upper(value)
	local container = mw.html.create('div')
		:addClass('ib-row')
	local name = mw.html.create('div')
			:addClass('ib-rowName')
			:wikitext(rowName .. ': ')
	local valueNode = mw.html.create('div')
	
	-- If no game then return value without link
	if game == nil then
		return container:node(name):node(valueNode:wikitext(value))
	end
	
	
	
	local catName,visibleName 
	if value == 'COACH' then
		linkName = 'Coaches'
		visibleName = 'Coach'
	end
	local categoryLink = '[[:Category:' .. game .. '/' .. linkName .. '|' .. visibleName ..']]'
	

	valueNode:wikitext(categoryLink)

	
	return container:node(name):node(valueNode)
end


return Role