« Utilisateur:Kims/Brouillon » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications Balise : Révoqué |
||
Ligne 1 : | Ligne 1 : | ||
{{ | local p = {} | ||
local LF = '\n' | |||
-------------------------------- | |||
----- Référentiel ----- | |||
-------------------------------- | |||
local data = { | |||
["fermentable"] = { }, | |||
["fermenté"] = {}, | |||
["mature"] = { } | |||
} | |||
-------------------------------- | |||
function buildRow(argValue, def) | |||
local note = argValue or '' | |||
if note ~= '' then note = LF .. note .. LF end | |||
return mw.html.create( 'div' ) | |||
:addClass( 'artisanat-colonne-titre' ) | |||
:wikitext( note ) | |||
:done() | |||
end | |||
function p._build(args) | |||
local res = mw.html.create( 'ul' ) | |||
:addClass( 'artisanat-colonne' ) | |||
local isEmpty = true | |||
for key, value in pairs(args) do | |||
local def = data[key:lower()] | |||
if def and value ~= '-' and value ~= 'vide' then | |||
isEmpty = false | |||
res:node(buildRow(value, def)) | |||
end | |||
end | |||
res:allDone() | |||
return res | |||
end | |||
function p.build(frame) | |||
local args = {} | |||
local argsParent = frame:getParent().args | |||
for cle, val in pairs(argsParent) do | |||
if val then | |||
val = mw.text.trim(val) | |||
if val ~= '' then | |||
args[cle] = val | |||
end | |||
end | |||
end | |||
return p._build(args) | |||
end | |||
return p |
Version du 19 juillet 2021 à 17:42
local p = {}
local LF = '\n'
Référentiel -----
local data = { ["fermentable"] = { }, ["fermenté"] = {}, ["mature"] = { } }
function buildRow(argValue, def) local note = argValue or if note ~= then note = LF .. note .. LF end
return mw.html.create( 'div' ) :addClass( 'artisanat-colonne-titre' ) :wikitext( note ) :done() end
function p._build(args) local res = mw.html.create( 'ul' ) :addClass( 'artisanat-colonne' ) local isEmpty = true
for key, value in pairs(args) do local def = data[key:lower()] if def and value ~= '-' and value ~= 'vide' then isEmpty = false res:node(buildRow(value, def)) end end
res:allDone()
return res end
function p.build(frame) local args = {}
local argsParent = frame:getParent().args for cle, val in pairs(argsParent) do if val then val = mw.text.trim(val) if val ~= then args[cle] = val end end end
return p._build(args) end
return p