Vés al contingut

Mòdul:Infobox images demo 2

De la Viquipèdia, l'enciclopèdia lliure
Icona de documentació de mòdul Documentació del mòdul [ mostra ] [ modifica el codi ] [ mostra l'historial ] [ refresca ]

Mòdul Infobox images demo 2 (codi · ús · discussió · proves · tests · casos prova | subpàgines · enllaços)

A continuació es mostra la documentació transclosa de la subpàgina /ús. [salta a la caixa de codi]


This module is a Global infobox used for the examples of Help:Multilanguage infobox images, allowing manually assignment of one or two images or reading up two images (if they exist) linked to an item of wikidata (WD).

This module uses an items and i18n. The size of the images has been set to 150x150px, in order to take up less space. Module:Infobox images demo 1 is similar to this module.

local p = {}

local SA	= require "Module:SimpleArgs"
local MLMT	= require "Module:Multilang module tools"
local GIBT	= require "Module:Global infobox tools"
local GIBTi	= require "Module:Global infobox tools/items"
local GIBTi18n	= require (SA.I18nName ("Global infobox tools"))
local IID2i = require "Module:Infobox images demo 2/items"
local IID2i18n = require (SA.I18nName ("Infobox images demo 2"))

local ModuleName = 'Infobox images demo 2'
GIBT.SetColorsAndIcon (ModuleName,
	GIBTi18n.lcol.science, --group color
	nil)
local rs = { --reserved keys and their modified values for infobox configuration
	--for default stored values of the other options look at list with allitems=list
}
local items = { --used key names 
	[MLMT.k.Args] = { --parameter key, its name/s (as parameter) and optional Wikidata qualifiers/properties
		[GIBTi.rk.name] = {{"Name",	"name"}, "",}, --allways required
	},
	[MLMT.k.Labels] = { --label or header (hd_) key, and its value as Wikidata qualifier or property to read (or text)
	},	
}

function p.infobox(frame)
	local args, NArgs = SA.GetArgs (frame)
	args = GIBT.SetRsv_1ToArgs (ModuleName, frame, args, rs, IID2i18n.rs_val)
	local itemsM = GIBT.tableMerge (ModuleName, items, IID2i18n.items)
	GIBT.i_LoadI18n ()
	MLMT.IniLang (frame, args)
	SA.Error.handle = true
	local res = GIBT.ItemList_or_TempData (args, 'IMI', ModuleName, items, IID2i18n.items, IID2i.idx, IID2i.arg_lims)
	if res == nil then
		GIBT.IniLua (args, itemsM)
		local n_last_capt = GIBT.i_main (frame, args)
		return GIBT.CheckShowParams (frame, args, 
				{itemsM, --current module specific arguments
				GIBT.i_itemsM} --image module specific arguments
				)..
		    GIBT.InfoboxWithItsValues()
	else
		return res
	end	    
end --infobox

return p