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

Module:Mod: Difference between revisions

From PC Gaming Shelter
m Text replacement - "Has note" to "Has short description"
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 6: Line 6:
-- ['Form field name'] = { 'Semantic property', 'delimiter' }
-- ['Form field name'] = { 'Semantic property', 'delimiter' }
local propMap = {
local propMap = {
['Image']               = {'Image', 'file' },
['Image']               = {'Image', 'file' },
['Related game']       = {'Related game' },
['Related game']       = {'Related game' },
['Has mod type']       = {'Has mod type' },
['Has game mode']      = {'Has game mode' },
['Has developer']       = {'Has developer', ',' },
['Has mod type']       = {'Has mod type' },
['Has release date']   = {'Has release date' },
['Has developer']       = {'Has developer', ',' },
['Has status']         = {'Has status' },
['Has release date']   = {'Has release date' },
['Has short description']           = {'Has short description' }
['Has status']         = {'Has status' },
['Works on']            = {'Works on game version', ',' },
['Has short description']   = {'Has short description' }
}
}
return propMap
return propMap
Line 33: Line 35:
rows = {
rows = {
'Related game',
'Related game',
'Has game mode',
'Has mod type',
'Has mod type',
'Has developer',
'Has developer',
'Has release date',
'Has release date',
'Has status',
'Has status',
'Works on',
'Has short description'
'Has short description'
}
}
},
},
['Download'] = {
['Download'] = {
heading = '<i class="fas fa-play mr-2"></i> Play',
heading = '<i class="fas fa-link mr-2"></i> Links',
template = 'Infobox/Download',
template = 'Infobox/Download',
order = '3',
order = '3',

Latest revision as of 22:08, 15 June 2026

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

local utils = require( 'Module:Utils' )

local p = {}

local function propertiesPlan()
	-- ['Form field name'] = { 'Semantic property', 'delimiter' }
	local propMap = {
		['Image']               	= {'Image', 'file' },
		['Related game']        	= {'Related game' },
		['Has game mode']       	= {'Has game mode' },
		['Has mod type']        	= {'Has mod type' },
		['Has developer']       	= {'Has developer', ',' },
		['Has release date']    	= {'Has release date' },
		['Has status']          	= {'Has status' },
		['Works on']            	= {'Works on game version', ',' },
		['Has short description']   = {'Has short description' }
	}
	return propMap
end

local function infoboxSectionPlan()
	local sectionMap = {
		['Cover image'] = {
			heading = '',
			template = 'Infobox/Cover',
			order = '1',
			rows = {
				'Image'
			}
		},
		['Mod Info'] = {
			heading = 'Mod Info',
			template = 'Infobox/Mod Info',
			order = '2',
			rows = {
				'Related game',
				'Has game mode',
				'Has mod type',
				'Has developer',
				'Has release date',
				'Has status',
				'Works on',
				'Has short description'
			}
		},
		['Download'] = {
			heading = '<i class="fas fa-link mr-2"></i> Links',
			template = 'Infobox/Download',
			order = '3',
			rows = {
				'Download links'
			}
		}
	}
	return sectionMap
end

function p.infobox(frame)
	local category   = 'Mods'
	local properties = propertiesPlan()
	local sections   = infoboxSectionPlan()
	local footer     = ''
	local infobox    = utils.createInfobox(frame, category, properties, sections, footer)
	return infobox
end

return p