« Module:Infobox » : différence entre les versions
De Nefald
Autres actions
arg.type cheche une infobox |
Preprocess Balises : Modification par mobile Modification par le web mobile |
||
(9 versions intermédiaires par 2 utilisateurs non affichées) | |||
Ligne 8 : | Ligne 8 : | ||
local args = getArgs(frame, {parentFirst = true}) | local args = getArgs(frame, {parentFirst = true}) | ||
-- | -- Récupérer le type d'infobox depuis les arguments du frame | ||
local infoboxType = frame.args[1] or frame.args.type | local infoboxType = frame.args[1] or frame.args.type | ||
if not infoboxType or infoboxType == '' then | if not infoboxType or infoboxType == '' then | ||
return '<div class="error">Type d\'infobox requis</div>' | return '<div class="error">Type d\'infobox requis</div>' | ||
end | end | ||
-- Récupérer la configuration | -- Récupérer la configuration | ||
local config = configs | local config = configs.load(infoboxType) | ||
if not config then | if not config then | ||
return '<div class="error">Type d\'infobox inconnu : ' .. infoboxType .. '</div>' | return '<div class="error">Type d\'infobox inconnu : ' .. infoboxType .. '</div>' | ||
end | end | ||
-- Construire l'infobox | -- Construire l'infobox en passant le frame pour le preprocessing | ||
return core.build(args, config) | return core.build(args, config, frame) | ||
end | end | ||
return p | return p |