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

Module:Clan

From PC Gaming Shelter
Revision as of 17:29, 25 March 2026 by WikiVisor (talk | contribs) (Created page with "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 {...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 roles = args['Has role'] or nil
	local html = mw.html.create()

	if community then 
		local escalateLink = {
			['Member of'] = args['Member of']
		}
		mw.smw.set(escalateLink)
		
		html:tag('span'):wikitext(string.format('[[%s]]', community))
		
		if roles then
			 html:tag('span'):wikitext(string.format('(%s)', roles ))
		end
	end
	
	return html
end

return p