Module:Bandeau

De Lagny-sur-Marne Wiki
Version datée du 8 mars 2013 à 10:47 par 0x010D (discussion | contributions) (Création du module Bandeau ; Fonction méta-bandeau d'avertissement)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Aller à la navigation Aller à la recherche

-- Module dédié à la création de bandeaux en tous genres

local fun = {}

function fun.metaBandeauAvertissement(frame)

   local pframe = frame:getParent()
   local arguments = pframe.args
   return fun.do_metaBandeauAvertissement(arguments)

end

-- Squelette d'un bandeau d'avertissement function fun.do_metaBandeauAvertissement(arguments) local result = "" local niveau = arguments.niveau or ""

   local bClass = mw.ustring.gsub(niveau,"é","e")

local icone = ""

   local texte = ""
   

-- Icônes prédéfinies local iconeTable = { grave = "Fairytale no.svg", ["modéré"] = "Emblem-important.svg", information = "Information_icon.svg", ["ébauche"] = "Nuvola_apps_kedit.svg" }

-- Utiliser l'icône fournie s'il y a lieu, ou prendre parmi celles de la table if(arguments["icône-complexe"] ~= nil) then icone = arguments["icône-complexe"] else

icone = "

[[Fichier:" .. (arguments["icône"] or iconeTable[arguments.niveau] or "Icon apps query.svg") .. "|45x35px|alt=|link=]]

"

end

-- Texte du bandeau if(arguments.texte ~= nil) then

texte = "

" .. arguments.texte .. "

"

end

-- Mise en boîte

result = "

" .. icone .. "
" .. (arguments.titre or "Pas de titre") .. "" .. (arguments.date or "") .. "
" .. texte .. "
" .. (arguments["supplément"] or "") .. "

"

return result end

return fun