Aller au contenu

Module:Infobox/Idéologie

Une page de Wikipédia, l'encyclopédie libre.
Ceci est une version archivée de cette page, en date du 19 décembre 2024 à 18:00 et modifiée en dernier par MarinBzh (discuter | contributions) (Structuration et correction des erreurs). 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 Idéologie.


local wikidata = require "Module:Wikidata"
local jeu = require "Module:Infobox/Fonctions"
local geo = require "Module:Infobox/Fonctions/Géolocalisation"
local localdata = require "Module:Infobox/Localdata"
local p = {}

-- Fonction pour afficher l'image principale
function p.image()
    local image = localdata["image"]
    if image then
        return {
            type = "image",
            value = image,
            style = { ["width"] = "200px", ["height"] = "auto" }
        }
    end
end

-- Fonction pour afficher le logo
function p.logo()
    local logo = localdata["logo"]
    if logo then
        return {
            type = "image",
            value = logo,
            style = { ["width"] = "150px", ["height"] = "auto" }
        }
    end
end

-- Fonction permettant l'affichage de la partie succession
local function buildsuccession()
    localdata["précédent"] = localdata["précédent"] or wikidata.formatStatements {
        property = "P179",
        showonlyqualifier = "P155"
    }
    localdata["suivant"] = localdata["suivant"] or wikidata.formatStatements {
        property = "P179",
        showonlyqualifier = "P156"
    }
    localdata["idéologie"] = localdata["idéologie"] or wikidata.formatStatements {
        property = "P179"
    }

    -- Fonction pour définir le titre de la partie succession
    local function titre(a, b, c)
        if c and (a or b) then
            return "<i>" .. c .. "</i>"
        end
    end

    -- Fonction pour afficher les articles de la partie succession
    local function succession(a, b, c, d)
        local succession = {}
        if a and b then
            succession["before"] = "<i>" .. a .. "</i> ([[" .. b .. " idéologie|" .. b .. "]])"
        elseif a then
            succession["before"] = "<i>" .. a .. "</i>"
        end
        if c and d then
            succession["after"] = "<i>" .. c .. "</i> ([[" .. d .. " idéologie|" .. d .. "]])"
        elseif c then
            succession["after"] = "<i>" .. c .. "</i>"
        end
        return succession
    end

    -- Si "précédent" ou "suivant" sont définis, afficher la succession
    if localdata["précédent"] or localdata["suivant"] then
        return {
            {
                type = "table",
                separator = true,
                mixeds = {
                    { type = "mixed1col", value = titre(localdata["précédent"], localdata["suivant"], localdata["idéologie"]) }
                }
            },
            {
                type = "table",
                separator = true,
                mixeds = {
                    {
                        type = "succession",
                        color = "transparent",
                        value = succession(
                            localdata["précédent"],
                            localdata["date précédent"],
                            localdata["suivant"],
                            localdata["date suivant"]
                        )
                    }
                }
            }
        }
    end
end

-- Fonction pour afficher le slogan
function p.slogan()
    return {
        type = "text",
        style = { ["font-weight"] = "normal", ["font-style"] = "italic" },
        value = function()
            local slogan = localdata["slogan"]
            if slogan then
                return "« " .. slogan .. " »"
            end
        end
    }
end

-- Fonction pour définir la couleur principale
function p.maincolor()
    local user_input = localdata["couleur boîte"]
    if user_input then
        -- Ajout du "#" si nécessaire
        if user_input:sub(1, 1) ~= "#" then
            return "#" .. user_input
        else
            return user_input
        end
    else
        return "#4A6AA5"  -- Couleur par défaut
    end
end

-- Retour du module principal
return {
    maincolor = p.maincolor(),
    parts = {
        jeu.title({}, "white"),
        p.logo(), -- Affichage du logo
        p.image(), -- Affichage de l'image
        p.slogan(),
        {
            type = 'table',
            title = 'Histoire',
            mixeds = {
                { type = 'row', label = 'Fondation', value = {'création', 'fondation', 'date_de_fondation'}, wikidata = {property = {'P571', 'P740'}, showqualifiers = {'P518', 'P1810', 'P4649', 'P5168', 'P8338'}, conjtype = 'new line'}, showsource = true },
                { type = 'row', label = 'Dissolution', value = 'dissolution', wikidata = {property = 'P576'}, showsource = true },
                { type = 'row', label = 'Origine', value = {'origine'} },
                { type = 'row', label = 'Prédécesseur', plurallabel = 'Prédécesseurs', value = {'remplace', 'a remplacé', 'prédécesseur'}, wikidata = {property = {'P1365', 'P155', 'P1398'}, removedupes = true}, showsource = true },
                { type = 'row', label = 'Successeur', plurallabel = 'Successeurs', value = {'remplacé par', 'successeur'}, wikidata = {property = {'P1366', 'P156', 'P167'}, removedupes = true}, showsource = true },
                { type = 'row', label = 'Scission de', plurallabel = 'Scissions de', value = {'scission de'}, showsource = true },
                { type = 'row', label = 'Fusion de', plurallabel = 'Fusions de', value = {'fusion de'}, showsource = true },
                { type = 'row', label = 'Scission dans', plurallabel = 'Scissions dans', value = {'scission dans'}, showsource = true },
                { type = 'row', label = 'Fusionné dans', plurallabel = 'Fusionnés dans', value = {'fusionné dans'}, showsource = true }
            }
        },
        {
            type = 'table',
            title = 'Principes',
            mixeds = {
                { 
                    type = 'row', 
                    label = 'Sigle', 
                    plurallabel = 'Sigles', 
                    value = {'sigle', 'acronyme'}, 
                    wikidata = {property = {'P1813'}, showlang = true, isinlang = {'fr', 'mul', 'en'}}, 
                    showsource = true 
                },
                { 
                    type = 'row', 
                    label = 'Surnom', 
                    plurallabel = 'Surnoms', 
                    value = {'surnom'}, 
                    wikidata = {property = {'P1449'}, showlang = true, isinlang = {'fr', 'en'}}, 
                    showsource = true 
                },
                { 
                    type = 'row', 
                    label = 'Code', 
                    plurallabel = 'Codes', 
                    value = 'code', 
                    wikidata = {property = 'P4550', atdate = "today"}, 
                    showsource = true 
                },
                { 
                    type = 'row', 
                    label = 'Structure', 
                    plurallabel = 'Structures', 
                    value = 'structure' 
                },
                { 
                    type = 'row', 
                    label = '[[Objet social]]', 
                    plurallabel = '[[Objet social|Objets sociaux]]', 
                    value = {'objet social', 'objets sociaux'}, 
                    wikidata = {property = 'P6346'}, 
                    showsource = true 
                },
                { 
                    type = 'row', 
                    label = 'Domaine d\'activité', 
                    plurallabel = 'Domaines d\'activité', 
                    value = {'discipline', 'disciplines', 'domaine', 'domaines', 'secteur'}, 
                    wikidata = {property = {'P101', 'P452', 'P2650'}, defaultlink = '-', excludevalues = {'Q112166212', 'Q107607934', 'Q29584118'}}, 
                    showsource = true 
                },
                { 
                    type = 'row', 
                    label = '[[Mouvement culturel|Mouvement]]', 
                    plurallabel = '[[Mouvement culturel|Mouvements]]', 
                    value = {'mouvement'}, 
                    wikidata = {property = 'P135'}, 
                    showsource = true 
                },
                { 
                    type = 'row', 
                    label = 'Financement', 
                    plurallabel = 'Financements', 
                    value = 'financement', 
                    wikidata = {property = 'P2770', speciallabels = {Q193219 = '[[subvention]]s', Q1124860 = '[[dons]]'}, conjtype = "and"}, 
                    showsource = true 
                },
                { 
                    type = 'row', 
                    label = 'Objectif', 
                    plurallabel = 'Objectifs', 
                    value = {'but', 'objectif', 'objectifs'}, 
                    wikidata = {property = 'P3712'}, 
                    showsource = true 
                },
                { 
                    type = 'row', 
                    label = 'Méthode', 
                    plurallabel = 'Méthodes', 
                    value = {'méthode', 'methode'}
                },
                { 
                    type = 'row', 
                    label = 'Filiale', 
                    plurallabel = 'Filiales', 
                    value = 'filiale', 
                    wikidata = {property = 'P355'}, 
                    showsource = true 
                },
                { 
                    type = 'row', 
                    label = 'Branche', 
                    plurallabel = 'Branches', 
                    value = 'branche', 
                    wikidata = {property = 'P199'}, 
                    showsource = true 
                },
                { 
                    type = 'row', 
                    label = 'Partenaire', 
                    plurallabel = 'Partenaires', 
                    value = 'partenaire'
                },
                { 
                    type = 'row', 
                    label = 'Dépend de', 
                    plurallabel = 'Dépendent de', 
                    value = 'dépend de'
                },
                { 
                    type = 'row', 
                    label = 'Affiliation', 
                    plurallabel = 'Affiliations', 
                    value = {'affiliation', 'affiliation_europeenne', 'affiliation_internationale', 'rattachement'}, 
                    wikidata = {property = {'P1416'}, showdate = true, defaultlinkquery = {property = {'P749', 'P127', 'P112'}}, qualifdefaultlinkquery = 'defaultquery', showqualifiers = {'P2868', 'P1416', 'P3831'}}, 
                    showsource = true
                },
                { 
                    type = 'row', 
                    label = 'Zone d\'activité', 
                    plurallabel = 'Zones d\'activité', 
                    value = {'couverture', 'région', 'zone opérationnelle', 'zone d\'influence'}, 
                    wikidata = {property = 'P2541', showqualifiers = 'P1001', speciallabels = {Q13780930 = '[[Monde (univers)|Monde entier]]', Q46 = '[[Europe]]'}}, 
                    showsource = true 
                },
                { 
                    type = 'row', 
                    label = 'Type', 
                    plurallabel = 'Types', 
                    value = {'type', 'association_type'}, 
                    wikidata = {property = 'P31', removedupes = true, showdate = true, showqualifiers = {'P642', 'P459', 'P1013', 'P5102'}, qualifconjtype = 'comma', defaultlink = '-', defaultlinkquery = 'defaultquery', excludevalues = {'Q43229', 'Q41176', 'Q45400320'}}
                }
            }
        },
        {
            type = 'table',
            title = 'Organisations',
            mixeds = {
                { type = 'mixed', label = 'Organisation régionale', plurallabel = 'Organisations régionales', value = 'organisations régionales' },
                { type = 'mixed', label = 'Organisation internationale', plurallabel = 'Organisations internationales', value = 'organisations internationales' }
            }
        },
        {
            type = 'table',
            title = 'Localisation',
            mixeds = {
                { type = 'mixed', label = 'Pays', plurallabel = 'Pays', value = 'pays', property = 'P17' },
                { type = 'mixed', label = 'Localisation', plurallabel = 'Localisations', value = 'localisation', wikidata = {property = 'P131'}, blockers = {'ville'} },
                { type = 'mixed', label = 'Ville', plurallabel = 'Villes', value = 'ville' }
            }
        },
        jeu.geoloc({ default_zoom = 13, maptype = localdata["type carte"], width = localdata["taille carte"] }),
        geo.geoloc({ marker = '' })
    }
}