Aller au contenu

Module:Charte

De Wikiquestia

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