Bureaucrate, commentadmin, emailconfirmed, flow-bot, Administrateurs d’interface, Modérateurs, staff, Masqueurs de modifications, Administrateur
45 256
modifications
Kims (discussion | contributions) Bureaucrate, commentadmin, emailconfirmed, flow-bot, Administrateurs d’interface, Modérateurs, staff, Masqueurs de modifications, Administrateur 45 256 modifications Aucun résumé des modifications |
Kims (discussion | contributions) Bureaucrate, commentadmin, emailconfirmed, flow-bot, Administrateurs d’interface, Modérateurs, staff, Masqueurs de modifications, Administrateur 45 256 modifications Aucun résumé des modifications |
||
Ligne 3 : | Ligne 3 : | ||
local LF = '\n' | local LF = '\n' | ||
-------------------------------- | |||
----- Référentiel | ----- Référentiel ----- | ||
-------------------------------- | |||
local data = { | local data = { | ||
["fermentable"] = { | ["fermentable"] = { | ||
description = "Premier stade du brassage." | |||
}, | }, | ||
["fermenté"] = { | ["fermenté"] = { | ||
description = "Second stade du brassage." | |||
}, | }, | ||
["mature"] = { | ["mature"] = { | ||
description = "Troisième stade du brassage." | |||
} | } | ||
} | } | ||
-------------------------------- | |||
function buildRow( | function buildRow(argValue, def) | ||
local note = | local note = argValue or '' | ||
if note | if note ~= '' then note = LF .. note .. LF end | ||
return mw.html.create( 'li' ) | return mw.html.create( 'li' ) | ||
Ligne 39 : | Ligne 29 : | ||
:tag( 'div' ) | :tag( 'div' ) | ||
:addClass( 'avt-interactions-text' ) | :addClass( 'avt-interactions-text' ) | ||
:tag( 'p' ) | |||
:wikitext(def.description) | |||
:done() | |||
:wikitext( note ) | :wikitext( note ) | ||
:done() | |||
:tag( 'li' ) | |||
:wikitext( '[[Fichier:Icon_range_inverse.png|x50px|center]]' ) | |||
:done() | :done() | ||
end | end | ||
function p._build(args) | function p._build(args) | ||
local res = mw.html.create( 'ul' ) | local res = mw.html.create( 'ul' ) | ||
:addClass( 'avt-interactions' ) | :addClass( 'avt-interactions' ) | ||
local isEmpty = true | |||
for key, value in pairs(args) do | |||
for | |||
local def = data[key:lower()] | local def = data[key:lower()] | ||
if def and | if def and value ~= '-' and value ~= 'vide' then | ||
isEmpty = false | isEmpty = false | ||
res:node(buildRow( | res:node(buildRow(value, def)) | ||
end | end | ||
end | end | ||
-- cas particulier | -- cas particulier l'inventaire du pnj est vide | ||
if isEmpty then | if isEmpty then | ||
res:node(buildRow( | res:node(buildRow(nil, data.vide)) | ||
end | end | ||
Ligne 83 : | Ligne 70 : | ||
val = mw.text.trim(val) | val = mw.text.trim(val) | ||
if val ~= '' then | if val ~= '' then | ||
args[cle] = | args[cle] = val | ||
end | end | ||
end | end |
modifications