Module:Infobox/Établissement pénitentiaire

Une page de Wikipédia, l'encyclopédie libre.

 Documentation[voir] [modifier] [historique] [purger]

Cette page définit un module d'infobox. Pour les conseils sur l'usage de ce module, voyez Modèle:Infobox Établissement pénitentiaire.


local building = require "Module:Infobox/Fonctions/Bâtiment"
local general = require "Module:Infobox/Fonctions"
local wikidata = require "Module:Wikidata"
local linguistic = require "Module:Linguistique"
local Langue1 -- on chargera Module:Langue si une langue est spécifiée
local Langue2 -- on chargera Module:Langue si une langue est spécifiée
local Langue3 -- on chargera Module:Langue si une langue est spécifiée

local function titre(localdata)
	local nom = linguistic.ucfirst( localdata['nom'] ) or linguistic.ucfirst( wikidata.getLabel(localdata.item) )
	local nom_local = linguistic.ucfirst( localdata["nom local"] )
	local langue_du_nom_local = localdata["langue du nom local"]
	local nom_local2 = linguistic.ucfirst( localdata["nom local 2"] )
	local langue_du_nom_local2 = localdata["langue du nom local 2"]
	if nom_local then
		Langue1 = Langue1 or require( 'Module:Langue' )
		if langue_du_nom_local and Langue1.codeLangue2{ langue_du_nom_local } and langue_du_nom_local ~= '' and langue_du_nom_local ~= 'fr' then
			nom_local = ' <br><small>' .. Langue1.indicationDeLangue{ '' , langue_du_nom_local, nom_local } .. ' \'\'' .. Langue1.langue{ langue_du_nom_local, nom_local } .. '\'\'</small>'
		else
			nom_local = ' <br><small>\'\'' .. nom_local .. '\'\'</small>'
		end
	else
		nom_local = ''
	end
	if nom_local2 then
		Langue2 = Langue2 or require( 'Module:Langue' )
		if langue_du_nom_local2 and Langue2.codeLangue2{ langue_du_nom_local2 } and langue_du_nom_local2 ~= '' and langue_du_nom_local2 ~= 'fr' then
			nom_local2 = ' <br><small>' .. Langue2.indicationDeLangue{ '' , langue_du_nom_local2, nom_local2 } .. ' \'\'' .. Langue2.langue{ langue_du_nom_local2, nom_local2 } .. '\'\'</small>'
		else
			nom_local2 = ' <br><small>\'\'' .. nom_local2 .. '\'\'</small>'
		end
	else
		nom_local2 = ''
	end
	return nom .. nom_local .. nom_local2
end

local function surnom(localdata)
	local langue_du_surnom = localdata['langue du surnom']
	local contenu_surnom = linguistic.ucfirst( localdata['surnom'] )
	Langue3 = Langue3 or require( 'Module:Langue' )
	if contenu_surnom then
		if langue_du_surnom and Langue3.codeLangue2{ langue_du_surnom } and langue_du_surnom ~= '' and langue_du_surnom ~= 'fr' then
			return Langue3.indicationDeLangue{ '' , langue_du_surnom, contenu_surnom } .. ' \'\'\'<i>« ' .. Langue3.langue{ langue_du_surnom, contenu_surnom } .. ' »</i>\'\'\''
		else
			return '<i>\'\'\'« ' .. contenu_surnom .. ' »\'\'\'</i>'
		end
	else
		return ""
	end
end

return {
	maincolor = '#E1E1E1',

	parts = {
		{ type = 'title', value = titre },
		
--		{ function(localdata)
--			if surnom ~= "" then
--				type = 'text', value = surnom, style = { background = '#E1E1E1', height = '20px', 'vertical-align = middle' } 
--	    	end
--		end },
		
		building.mainimage('Article à illustrer Prison', 'Defaut.svg'),
		{type = 'table', title = 'Localisation', rows = {
				{
					type = 'row', 
					label = 'Pays', 
					value = function(localdata)
						local pays = localdata['pays']
						if pays and pays ~= "" then
 							return pays
 						else
 							return building.country()
						end
 					end
				}
			}
		}	
	}
}