« Module:Infobox » : différence entre les versions
De Nefald
Autres actions
Aucun résumé des modifications Balises : Révocation manuelle Révoqué |
m map |
||
| (2 versions intermédiaires par 2 utilisateurs non affichées) | |||
| Ligne 1 : | Ligne 1 : | ||
local core = require('Module:Infobox/Core') | local core = require('Module:Infobox/Core') | ||
local configs = require('Module:Infobox/Configs') | local configs = require('Module:Infobox/Configs') | ||
local getArgs = require('Module:Arguments').getArgs | local getArgs = require('Module:Arguments').getArgs | ||
| Ligne 6 : | Ligne 6 : | ||
function p.main(frame) | function p.main(frame) | ||
local args = getArgs(frame, {parentFirst = true}) | local args = getArgs(frame, { parentFirst = true }) | ||
-- | -- Type d'infobox (ex: "Geographie" via #invoke:Infobox|main|Geographie) | ||
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 | ||
-- Charger la configuration du type | |||
local config = configs.load(infoboxType) | |||
-- | |||
local config = configs | |||
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 : ' .. tostring(infoboxType) .. '</div>' | ||
end | end | ||
-- Construire l'infobox | -- Construire l'infobox | ||
return core.build(args, config) | return core.build(args, config, frame) | ||
end | end | ||
return p | return p | ||