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 20 avril 2019 à 15:24 et modifiée en dernier par Lofhi (discuter | contributions) (suppression des dépendances inutiles). 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 general = require "Module:Infobox/Fonctions"
local datec = require "Module:Date complexe"
local date = require "Module:Date"
local duree = require "Module:Durée"
local localdata = require "Module:Infobox/Localdata"
local p = {}

local maincolor, secondcolor, thirdcolor = "#DFEDFF", "#DFEDFF", "#000000" --couleurs de l'infobox.

-- fonction de liste de dates d'élection sans les paramètres en dur dans le module
local function datelec()
	local rows = {}
	for i = 1, 10 do
		table.insert(
			rows,
			{
				type = "row",
				label = function(localdata)
					return localdata["nom datelec" .. tostring(i)] or ""
				end,
				value = "datelec" .. tostring(i)
			}
		)
	end
	return rows
end

-- fonction de liste de présidents d'assemblée sans les paramètres en dur dans le module
local function listepdt()
	local rows = {}
	for i = 1, 10 do
		table.insert(
			rows,
			{
				type = "row",
				label = function(localdata)
					return localdata["nompdt" .. tostring(i)] or ""
				end,
				value = "pdt" .. tostring(i)
			}
		)
	end
	return rows
end

-- fonction de liste d'évènements sans les paramètres en dur dans le module
local function evts()
	local rows = {}
	for i = 1, 40 do
		table.insert(
			rows,
			{
				type = "row",
				label = function(localdata)
					return localdata["date" .. tostring(i)] or ""
				end,
				value = "evt" .. tostring(i)
			}
		)
	end
	return rows
end

-- fonction de calcul de la durée
local function dates()
	local value

	if localdata["date de début"] == nil or localdata["date de fin"] == nil then
		value = ""
	else
		value =
			datec.daterange(
			date.modeleDate(localdata["date de début"]),
			date.modeleDate(localdata["date de fin"]),
			{precision = 11}
		)
	end

	return value
end

local function affichdates()
	local rows = {}
	do
		table.insert(
			rows,
			{
				type = "row",
				value = "affichdate"
			}
		)
	end
	return rows
end

localdata["affichdate"] = dates()

local function dur()
	local value = localdata["durée"]
	if not value then
		return nil
	else
		return value
	end
end

local function affichdur()
	local rows = {}
	do
		table.insert(
			rows,
			{
				type = "row",
				value = "affichdur"
			}
		)
	end
	return rows
end

localdata["affichdur"] = dur()

-- titres de section modifiables

local function infos() -- Informations générales
	local value = localdata["titre infos"]
	if not value then
		return "Informations générales"
	else
		return value
	end
end

local function elec() -- élections
	local value = localdata["titre élections"]
	if not value then
		return "Élections"
	else
		return value
	end
end

local function typelistepdt() -- Nom de la liste des présidents d'assemblée
	local value = localdata["nomlistepdt"]
	if not value then
		return nil
	else
		return value
	end
end

local function compo() -- Composition de la chambre
	local value = localdata["titre composition"]
	if not value then
		return "Composition de la Chambre"
	else
		return value
	end
end

local function gvt() -- Gouvernement
	local value = localdata["type gvt"]
	if not value then
		return "Gouvernements"
	else
		return value
	end
end

local function chh() -- Chambre haute
	local value = localdata["titre chambre haute"]
	if not value then
		return nil
	else
		return value
	end
end

local function chb() -- Chambre basse
	local value = localdata["titre chambre basse"]
	if not value then
		return nil
	else
		return value
	end
end

local function ach() -- Autre chambre
	local value = localdata["titre autre chambre"]
	if not value then
		return "Autre Chambre"
	else
		return value
	end
end

local function liste() -- Liste des législatures
	local value = localdata["nomliste"]
	if not value then
		return nil
	else
		return value
	end
end

return {
	maincolor = "defaut",
	parts = {
		general.title(),
		{type = "table", rows = affichdates(), style = {["text-align"] = "center", ["border-top"] = "1px solid #DFEDFF"}}, --dates de début et de fin du Parlement
		{type = "table", rows = affichdur(), style = {["text-align"] = "center", ["border-bottom"] = "1px solid #DFEDFF"}}, --durée du Parlement
		{type = "images", imageparameters = {"drapeau", "blason"}, captionparameter = "légende", uprightparameter = "upright"}, --drapeau et blason côte à côte
		{
			type = "table",
			title = "Caractéristiques",
			rows = {
				{type = "row", label = "Créateur", value = "créateur"},
				{type = "row", label = "Règne", value = "règne"},
				{type = "row", label = "Convocateur", value = "convocateur"},
				{type = "row", label = "Date de convocation", value = "date de convocation"},
				{type = "row", label = "Cause", value = "cause création"},
				{
					type = "row",
					label = function(localdata)
						if localdata["titre autre organe"] then
							return localdata["titre autre organe"]
						else
							return "Autre organe gouvernemental"
						end
					end,
					value = "autre organe"
				},
				{
					type = "row",
					label = function(localdata)
						if localdata["titre parlement"] then
							return localdata["titre parlement"]
						else
							return "Parlement"
						end
					end,
					value = "parlement"
				}
			}
		},
		{
			type = "table",
			title = infos(),
			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"]
						else
							return "Chef de l'état"
						end
					end,
					value = "chef de l'état",
					property = "P6"
				}
			}
		},
		{
			type = "table",
			title = elec(), -- élections
			rows = {
				{type = "row", label = "Cause", value = "cause"},
				{
					type = "row",
					label = function(localdata)
						if localdata["type mode"] 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", rows = datelec()},
		{type = "table", title = typelistepdt(), rows = listepdt()},
		{
			type = "table",
			title = compo(), --Composition de la Chambre
			rows = {
				{
					type = "row",
					label = function(localdata)
						if localdata["type pdéputés"] then
							return localdata["type pdéputés"]
						else
							return "Président de la Chambre des Députés"
						end
					end,
					value = "pdéputés"
				},
				{
					type = "row",
					label = function(localdata)
						if localdata["nom nb"] then
							return localdata["nom nb"]
						else
							return "Nombre de députés"
						end
					end,
					value = "ndéputés"
				},
				{type = "row", label = "Sections", plurallabel = "Sections", value = "section"}
			}
		},
		{type = "images", imageparameters = "imagech", captionparameter = "légendech"},
		{
			type = "table",
			rows = {
				{type = "row", label = "Groupes politiques", value = "groupes"}
			}
		},
		-- si chambre basse
		{
			type = "table",
			title = chb(),
			rows = {
				{
					type = "row",
					label = function(localdata) -- nom de la chambre basse
						if localdata["type chambre basse"] then
							return localdata["type chambre basse"]
						else
							return "Chambre basse"
						end
					end,
					value = "chambre basse"
				},
				{
					type = "row",
					label = function(localdata) -- président de la chambre basse
						if localdata["nom pdt chambre basse"] then
							return localdata["nom pdt chambre basse"]
						else
							return "Président de la Chambre des députés"
						end
					end,
					value = "pdt chambre basse"
				},
				{
					type = "row",
					label = function(localdata) -- nombre de députés
						if localdata["nom nb chambre basse"] then
							return localdata["nom nb chambre basse"]
						else
							return "Nombre de députés"
						end
					end,
					value = "nb chambre basse"
				},
				{
					type = "row",
					label = function(localdata) -- mode d'élection
						if localdata["nom mode chambre basse"] then
							return localdata["nom mode chambre basse"]
						else
							return "Mode d'élection des députés"
						end
					end,
					value = "mode chambre basse"
				},
				{
					type = "row",
					label = function(localdata) -- législatures
						if localdata["nom liste chambre basse"] then
							return localdata["nom liste chambre basse"]
						else
							return "Nombre de législatures"
						end
					end,
					value = "liste chambre basse"
				}
			}
		},
		-- si chambre haute
		{
			type = "table",
			title = chh(),
			rows = {
				{
					type = "row",
					label = function(localdata) -- nom de la chambre haute
						if localdata["type chambre haute"] then
							return localdata["type chambre haute"]
						else
							return "Chambre haute"
						end
					end,
					value = "chambre haute"
				},
				{
					type = "row",
					label = function(localdata) -- président de la chambre haute
						if localdata["nom pdt chambre haute"] then
							return localdata["nom pdt chambre haute"]
						else
							return "Président du Sénat"
						end
					end,
					value = "pdt chambre haute"
				},
				{
					type = "row",
					label = function(localdata) -- nombre de sénateurs
						if localdata["nom nb chambre haute"] then
							return localdata["nom nb chambre haute"]
						else
							return "Nombre de sénateurs"
						end
					end,
					value = "nb chambre haute"
				},
				{
					type = "row",
					label = function(localdata) -- mode d'élection
						if localdata["nom mode chambre haute"] then
							return localdata["nom mode chambre haute"]
						else
							return "Mode d'élection des sénateurs"
						end
					end,
					value = "mode chambre haute"
				},
				{
					type = "row",
					label = function(localdata) -- législatures
						if localdata["nom liste chambre haute"] then
							return localdata["nom liste chambre haute"]
						else
							return "Sénatoriales"
						end
					end,
					value = "liste chambre haute"
				}
			}
		},
		-- si autre chambre
		{
			type = "table",
			title = ach(),
			rows = {
				{
					type = "row",
					label = function(localdata)
						if localdata["type autre chambre"] then
							return localdata["type autre chambre"]
						else
							return "Autre Chambre"
						end
					end,
					value = "autre chambre"
				}
			}
		},
		-- Liste des gouvernements
		{
			type = "table",
			title = gvt(),
			rows = {
				{type = "row", value = "liste gvt"}
			}
		},
		-- Histoire et évènements
		{type = "table", title = "Histoire et événements", rows = evts()},
		-- Navbox
		{
			type = "table",
			title = liste(),
			rows = {
				{
					type = "navbox",
					previousval = "précédé par",
					previouswikidata = {property = "P155", showonlyqualifier = "P155", numval = 1},
					nextval = "suivi par",
					nextwikidata = {property = "P156", showonlyqualifier = "P156", numval = 1},
					inner = true
				}
			}
		}
	}
}