PC Gaming Shelter
An archive dedicated to preserving PC Gaming history and more

Module:Clan

From PC Gaming Shelter
Revision as of 17:48, 25 March 2026 by WikiVisor (talk | contribs)

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

local utils = require( 'Module:Utils' )

local p = {}

local function propertiesPlan()
	-- ['Form field name'] = { 'Semantic property', 'delimiter' }
	local propMap = {
		['Member of']           = {'Member of' },
		['Has role']            = {'Has role', ',' },
		['Has note']            = {'Has note' }
	}
	return propMap
end

function p.main(frame)
	local args = frame:getParent().args
	local propMap = propertiesPlan()
	local props = utils.setProperties(propMap, args) or {}
	mw.smw.subobject(props)
	
	local community = args['Member of'] or nil
	
	local html = mw.html.create()

	if community then 
		local escalateLink = {
			['Member of'] = args['Member of']
		}
		mw.smw.set(escalateLink)
	
		local roles = args['Has role'] or nil
		if roles then
			roles = string.format(' (%s)', roles )
		else
			roles = ''
		end	
		
		local note = args['Has note'] or nil
		if note then
			note = frame:callParserFunction(
				'#info', note
			)
		else
			note = ''
		end
		
		html:tag('span'):wikitext(string.format('[[%s]]%s %s', community, roles, note))
	end
	
	return html
end

return p