Module:Character/config

De Semantic MediaWiki - Sandbox

This module holds a lua class representing a person. It uses Module:SSC base for its functionality and gets its configuration from Module:Character/config.

Usage[modifier le wikicode]

local character = require( 'Module:Character/class' ):new()
-- for example, this call would be placed inside the main function called on the template:
return character:renderPage()

For available public methods see Module:SSC base.


return {
	-- **********************
	-- * mandatory settings *
	-- **********************
	
	-- this is your type of entity
	entityType = 'Character',
	
	-- this is the category, the entities of the class will be put in
	category = 'Characters',
	
	-- lists all available pairs "template parameter" -> "semantic property"
	-- if you want to have a field in the template without storing it semantically, set it to true
	parameters = {
		name				= 'has name',
		gender				= 'has gender',
		ability				= 'has ability',
		creator				= 'was created by',
		['wikipedia page']	= 'is described on'
	},

	-- tell the class, which fields are mandatory
	-- for every argument in this list not present on your page's template call,
	-- an error will be displayed
	mandatory = { 'ability', 'gender', },
	
	-- these fields possibly contain more than one value
	listFields = { 'ability' },
	
	-- separator used in list fields
	delimiter = ',',

	-- *********************
	-- * optional settings *
	-- *********************
	-- the headline of the entity's page
	headline = 'This is a page about a fictional character',

	-- INFOBOX CONFIG HERE
	-- here you can disable your infobox
	omitInfoBox = false,

	-- this is the name of the field, used as title in the infobox
	titleField = 'name',
	
	-- this defines, which fields are put into your infobox and in which order
	infoboxConfig = {
		-- for every row in your infobox, add a table here, containing at least the entry "field" which
		-- refers to the data field to display. if you omit the entry "label", the field will be displayed
		-- over both columns
		{ field = 'gender', label = 'Gender' },
		{ field = 'creator', label = 'Created by' },
		{ field = 'wikipedia page', label = 'Wikipedia' },
		{ field = 'ability' },
		-- why is this not defined as an array: lua does not maintain the order of items in an array but accesses them randomly
	},
	
	-- configure here, which fields should be linked (or form-linked)
	linkFields = {
		-- if a field is set to true, it will be linked
		-- if it is set to a string, #formlink will be used
		creator	= 'Person',
	},
}
Les cookies nous aident à fournir nos services. En utilisant nos services, vous acceptez notre utilisation de cookies.