Aller au contenu

Module:Infobox/Parlement

Une page de Wikipédia, l'encyclopédie libre.
Ceci est une version archivée de cette page, en date du 28 avril 2018 à 18:04 et modifiée en dernier par Tomo8 5 (discuter | contributions) (Simplification). Elle peut contenir des erreurs, des inexactitudes ou des contenus vandalisés non présents dans la version actuelle.

 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 Parlement.


local location = require "Module:Infobox/Fonctions/Géolocalisation"
local general = require "Module:Infobox/Fonctions"
local person = require "Module:Infobox/Fonctions/Personne"
local datec = require "Module:Date complexe"
local date = require "Module:Date"
local convert = require "Module:Conversion"
local wikidata = require "Module:Wikidata"
local localdata = require "Module:Infobox/Localdata"
local p = {}

local maincolor, secondcolor, thirdcolor = '#DFEDFF', '#DFEDFF', '#000000'

-- A améliorer

local function format3(event, period, predecessor, successor, displayformat, details)
	if details then
		details = '<span style="font-weight:normal">' .. details .. '</span>'
		event = linguistic.conj({event, details}, "new line")
	end
	local mainrow =  {type = 'row1col', color = 'DFEDFF', value = event }
	if period then
		period = '<span style="font-weight:normal">' .. period .. '</span>'
	end
	local periodrow = {type = 'row1col', color = '#DFEDFF', value = period }
	local successionrow = {
		style = {['background-color'] = '#DFEDFF', ['padding-bottom'] = '2%'},
		type = 'navbox',
		inner = true,
		previousval = function() return predecessor end,
		nextval = function() return successor end,
	}

	return {type = 'multi', rows = {mainrow, periodrow, successionrow}}
end


local function timeline(localparam, wdconf, timelineformat, title, singtitle, details) -- affiche date : événement (suppose les événements déjà triés)
	local rows = {}
	local function returnTable()
		return {
			type = "table",
			title = title,
			rows = rows
	}
	end
	
	-- avec données locales
	local val = localdata[localparam]
	if val == '-' then
		return nil
	elseif val then
		table.insert(rows, {type = 'row1col', color = '#DFEDFF', value = val})
		return returnTable()
	end

	local displayformats = {
		A = format1,
		B = format2,
		C = format3,
	}
	local applyformat = displayformats[timelineformat] or displayformats['A']
	rows = {}
	return returnTable()
end


function p.liste() 

	local localparam = "nomliste"
	local wdconf = nil
	local displayformat = "C"
	
	return timeline(localparam, wdconf, displayformat, title, singtitle)
end

function p.gvt() 

	local localparam = "type gvt"
	local wdconf = nil
	local displayformat = "C"
	
	return timeline(localparam, wdconf, displayformat, title, singtitle)
end

local startpoint = 'startpoint'
local endpoint = 'endpoint'
-- Fin de code issu de Infobox/fonctions/Personne - merci !
local function gvt()
	local value = localdata['type gvt'] 
		return value
end


return 
	{
	maincolor = 'defaut',
    parts =
    {
    	general.title(),
    	general.blason(),
		general.flag(upright),
		datec.between(startpoint, endpoint),
    	{type = 'table',
    		rows = 	{
    				{type = 'row', label = 'Date de début', value = 'startpoint', property = 'P571'},
    				{type = 'row', label = 'Date de fin', value = 'endpoint', property = 'P576'},
    				}					-- Paragraphe à revoir entièrement pour afficher : "Date de début" ; "Date de fin" et "Durée" automatique
		},
		{type = 'table', title='Informations générales',
			rows =	{
					{type = 'row', label = 'Type', value = 'type', property = 'P31'},
					{type = 'row', label = function ( localdata )
						if localdata['type texte'] then
							return localdata['type texte'] else return 'Texte Fondamental'
						end
					end, value = 'texte fondamental', property = 'P457'},
					{type = 'row', label = 'Lieu', value = 'lieu', property = 'P159'},
					{type = 'row', label = function ( localdata )
						if localdata['type régime'] then
							return localdata['type régime'] else return 'Régime'
						end
					end, value = 'régime', property = 'P122'},
					{type = 'row', label = function ( localdata )
						if localdata['type chef état'] then
							return localdata['type chef état']
						end
					end, value = "chef de l'état", property = 'P6'},
						}
	},
		{type = 'table', title = 'Composition de la Chambre',
			rows = {
					{type = 'row', label = 'Cause', value = 'cause'},
					{type = 'row', label = 'Président de la Chambre des Députés', value = 'pdéputés'},
					{type = 'row', label = 'Nombre de députés', value = 'ndéputés'},
					{type = 'row', label = function ( localdata )
						if localdata['type lég'] then
							return localdata['type mode'] else 
								return "Mode d'élection"
						end
					end, value = 'mode élection'},
					{type = 'row', label = function ( localdata )
						if localdata['type lég'] then
							return localdata['type lég'] else 
								return "Nombre de législatures"
						end
					end, value = 'nlégislatures'},
					}
	},
		{type = 'table', title = 'Autre Chambre',
			rows = {general.mainimage(),
					{type = 'row', label = function ( localdata )
						if localdata['type autre chambre'] then
							return localdata['type autre chambre'] else 
								return "Autre Chambre"
						end
					end, value = 'chambre haute'},
					}
	},
			{type = 'table', title=gvt(),
			rows = {
					{type = 'row', value = 'liste gvt'},
					}
	},
			{type = 'table', title = 'Histoire et événements',
			rows = {
					{type = 'row', label = function ( localdata )
						if localdata['date1'] then
							return date.modeleDate(localdata['date1']) else 
								return "Date à préciser"
						end
					end, value = 'evt1'},
					{type = 'row', label = function ( localdata )
						if localdata['date2'] then
							return date.modeleDate(localdata['date2']) else 
								return "Date à préciser"
						end
					end, value = 'evt2'},
					{type = 'row', label = function ( localdata )
						if localdata['date3'] then
							return date.modeleDate(localdata['date3']) else 
								return "Date à préciser"
						end
					end, value = 'evt3'},
					{type = 'row', label = function ( localdata )
						if localdata['date4'] then
							return date.modeleDate(localdata['date4']) else 
								return "Date à préciser"
						end
					end, value = 'evt4'},
					{type = 'row', label = function ( localdata )
						if localdata['date5'] then
							return date.modeleDate(localdata['date5']) else 
								return "Date à préciser"
						end
					end, value = 'evt5'},
					{type = 'row', label = function ( localdata )
						if localdata['date5'] then
							return date.modeleDate(localdata['date5']) else 
								return "Date à préciser"
						end
					end, value = 'evt5'},
					{type = 'row', label = function ( localdata )
						if localdata['date6'] then
							return date.modeleDate(localdata['date6']) else 
								return "Date à préciser"
						end
					end, value = 'evt6'},
					{type = 'row', label = function ( localdata )
						if localdata['date7'] then
							return date.modeleDate(localdata['date7']) else 
								return "Date à préciser"
						end
					end, value = 'evt7'},
					{type = 'row', label = function ( localdata )
						if localdata['date8'] then
							return date.modeleDate(localdata['date8']) else 
								return "Date à préciser"
						end
					end, value = 'evt8'},
					{type = 'row', label = function ( localdata )
						if localdata['date9'] then
							return date.modeleDate(localdata['date9']) else 
								return "Date à préciser"
						end
					end, value = 'evt9'},
					{type = 'row', label = function ( localdata )
						if localdata['date10'] then
							return date.modeleDate(localdata['date10']) else 
								return "Date à préciser"
						end
					end, value = 'evt10'},
					{type = 'row', label = function ( localdata )
						if localdata['date11'] then
							return date.modeleDate(localdata['date11']) else 
								return "Date à préciser"
						end
					end, value = 'evt11'},
					{type = 'row', label = function ( localdata )
						if localdata['date12'] then
							return date.modeleDate(localdata['date12']) else 
								return "Date à préciser"
						end
					end, value = 'evt12'},
					{type = 'row', label = function ( localdata )
						if localdata['date13'] then
							return date.modeleDate(localdata['date13']) else 
								return "Date à préciser"
						end
					end, value = 'evt13'},
					{type = 'row', label = function ( localdata )
						if localdata['date14'] then
							return date.modeleDate(localdata['date14']) else 
								return "Date à préciser"
						end
					end, value = 'evt14'},
					{type = 'row', label = function ( localdata )
						if localdata['date15'] then
							return date.modeleDate(localdata['date15']) else 
								return "Date à préciser"
						end
					end, value = 'evt15'},
					{type = 'row', label = function ( localdata )
						if localdata['date16'] then
							return date.modeleDate(localdata['date16']) else 
								return "Date à préciser"
						end
					end, value = 'evt16'},
					{type = 'row', label = function ( localdata )
						if localdata['date17'] then
							return date.modeleDate(localdata['date17']) else 
								return "Date à préciser"
						end
					end, value = 'evt17'},
					{type = 'row', label = function ( localdata )
						if localdata['date18'] then
							return date.modeleDate(localdata['date18']) else 
								return "Date à préciser"
						end
					end, value = 'evt18'},
					{type = 'row', label = function ( localdata )
						if localdata['date19'] then
							return date.modeleDate(localdata['date19']) else 
								return "Date à préciser"
						end
					end, value = 'evt19'},
					{type = 'row', label = function ( localdata )
						if localdata['date20'] then
							return date.modeleDate(localdata['date20']) else 
								return "Date à préciser"
						end
					end, value = 'evt20'},
				}
				
	},

			p.liste(),
			{type = 'navbox',
			previousparameter = "précédé par",
			previousproperty = "P155",
			nextparameter = "suivi par",
			nextproperty = "P156",
			separator = true,
			class = 'bordered',
		},
}
}