Module:Itemgroup/groups

From Wikidata
Jump to navigation Jump to search
Lua
CodeDiscussionLinksLink count SubpagesDocumentationTestsResultsSandboxLive code All modules

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

Code

--   Version from cawiki. 2021-10-18

--[[ 
This module is a data table used by function "group" of module:itemgroup.

It contains a list of "values" associated with a ["my group"],
 which will be returned if the Qid in {{{item|}}} matches any of the values in the list.
It allows templates to simulate a multivalue "if" or "switch" asking by the ["my group"],
 instead having the Qid target within code. In fact, it sinonimize different Qid to be processed in the same way.
It allows platform-level customization of template operation.

To have different collections of series linked to one (["my group"]), them may be gather under ["mytable"] subtable.
When invoked, the value of {{{item|}}} is searched within all ["mytable"] values
 and returns the corresponding ["my group"], or null if none match.

The name assigned to ["mytable"] and ["my group"] is free, but is determined by the template's use.
]]
local data = { 

--["mytable"] = {
--    ["mygroup"] = {'Qid1', 'Qid2'},
--}

-- tables and groups, edit below

-- Values used in template infobox elections and its subtemplates
["IBelection_yesorno"] = {
	["yes_in_referendum"]	= {'Q41216873', 'Q231043', 'Q24759380'},	-- /prepare
	["no_in_referendum"]	= {'Q41216897', 'Q19358049', 'Q24759450'}	-- /prepare
	},
["IBelection_type_election"] = {
        	-- <!--direct --><!-- indirect --> <!-- first-past-the-post -->
	["direct"]		 = {'Q1196727', 'Q877353', 'Q5557375', 'Q1211577', 'Q2746726', 'Q205759', 'Q31467', 'Q1307208', 'Q60788298', 'direct', 'directa', 'indirect'},
	["two_rounds"] 	 = {'Q615255', 'two_rounds', 'two rounds', 'dues rondes', 'dues voltes', 'dos rondas'},
	["proportional"] = {'Q31764', 'Q13365595',  'Q133', 'proportional', 'proporcional'},  -- party-list proportional representation
	["referendum"] 	 = {'Q43109', 'Q1458216', 'referendum'},    
	["limited"] 	 = {'Q3786779', 'limited'},      --vot limitat
	["double"]		 = {'double', 'double election', 'doble', 'doble elecció', 'doble elección'}
	}
-- end of tables, do not edit below
}

return data