Aller au contenu

« Module:Charte » : différence entre les versions

De Wikiquestia
Aucun résumé des modifications
Balise : Révoqué
Aucun résumé des modifications
Balise : Révoqué
Ligne 2 : Ligne 2 :


local chartes = {
local chartes = {
-- Exemple de chartes personnalisées
  defaut = {
biographie = {
    titre = "#ddd",
    hr = "#ccc",
    header = "Informations générales",
  },
  royaume = {
    titre = "#995333",
    hr = "#d8c9b8",
    header = '[[Fichier:Drapeau_du_Royaume.png|50px|center]]<br>Informations du Royaume',
  },
  biographie = {
     titre = "#334455",
     titre = "#334455",
     hr = "#8899aa",
     hr = "#8899aa",
     header = '[[Fichier:Pictogram lightgods.png]]'
     header = '[[Fichier:Portrait_Biographie.jpg|40px|left]]<br>Infos biographiques',
},
  }
empire = {
titre = "#993333",
soustitre = "#ffcccc",
hr = "#cc6666"
},
-- Couleurs par défaut
defaut = {
titre = "#eaecf0",
soustitre = "#a2a9b1",
hr = "#eaecf0"
}
}
}


function p.couleur(frame)
function p.couleur(frame)
local args = frame.args
  local args = frame.args or {}
local charte = args["charte"] or "defaut"
  local charte = args.charte or "defaut"
local type = args["type"] or "titre"
  local type_ = args.type or "titre"
  if chartes[charte] and chartes[charte][type_] then
    return chartes[charte][type_]
  else
    return chartes.defaut[type_] or ""
  end
end


if chartes[charte] and chartes[charte][type] then
function p.header(frame)
return chartes[charte][type]
  local args = frame.args or {}
else
  local charte = args.charte or "defaut"
return chartes["defaut"][type] or "#dddddd"
  if chartes[charte] and chartes[charte].header then
end
    return chartes[charte].header
  else
    return chartes.defaut.header or ""
  end
end
end


return p
return p

Version du 23 mai 2025 à 21:40

La documentation pour ce module peut être créée à Module:Charte/doc

local p = {}

local chartes = {
  defaut = {
    titre = "#ddd",
    hr = "#ccc",
    header = "Informations générales",
  },
  royaume = {
    titre = "#995333",
    hr = "#d8c9b8",
    header = '[[Fichier:Drapeau_du_Royaume.png|50px|center]]<br>Informations du Royaume',
  },
  biographie = {
    titre = "#334455",
    hr = "#8899aa",
    header = '[[Fichier:Portrait_Biographie.jpg|40px|left]]<br>Infos biographiques',
  }
}

function p.couleur(frame)
  local args = frame.args or {}
  local charte = args.charte or "defaut"
  local type_ = args.type or "titre"
  if chartes[charte] and chartes[charte][type_] then
    return chartes[charte][type_]
  else
    return chartes.defaut[type_] or ""
  end
end

function p.header(frame)
  local args = frame.args or {}
  local charte = args.charte or "defaut"
  if chartes[charte] and chartes[charte].header then
    return chartes[charte].header
  else
    return chartes.defaut.header or ""
  end
end

return p