« Module:Infobox/Core » : différence entre les versions
De Nefald
Autres actions
erreur suite implémentation CSS |
Coordonnées |
||
| Ligne 57 : | Ligne 57 : | ||
for _, champ in ipairs(section.champs or {}) do | for _, champ in ipairs(section.champs or {}) do | ||
if args[champ.cle] and args[champ.cle] ~= '' then | -- Cas spécial pour les coordonnées de spawn | ||
if champ.cle == 'spawn' and args.x and args.x ~= '' and args.y and args.y ~= '' and args.z and args.z ~= '' then | |||
local rowDiv = mw.html.create('div') | |||
:addClass('infobox-row') | |||
local labelDiv = mw.html.create('div') | |||
:addClass('infobox-label') | |||
:wikitext(champ.label) | |||
local valueDiv = mw.html.create('div') | |||
:addClass('infobox-value') | |||
-- Construction du lien vers la carte | |||
local mapUrl = string.format('[https://map.nefald.fr/?worldname=%s&mapname=surface&zoom=4&x=%s&y=%s&z=%s %s, %s, %s]', | |||
args.monde or '', args.x, args.y, args.z, args.x, args.y, args.z) | |||
valueDiv:wikitext("''" .. mapUrl .. "''") | |||
rowDiv:node(labelDiv):node(valueDiv) | |||
body:node(rowDiv) | |||
-- Traitement normal des autres champs | |||
elseif args[champ.cle] and args[champ.cle] ~= '' then | |||
local rowDiv = mw.html.create('div') | local rowDiv = mw.html.create('div') | ||
:addClass('infobox-row') | :addClass('infobox-row') | ||