|
|
Ligne 1 : |
Ligne 1 : |
| local p = {}
| | {{Fermentation |
| | | |fermentable =[[Gin toxique fermentable]] |
| local LF = '\n'
| | |fermenté =[[Gin Tonic toxique]] |
| | | |mature =[[Gin toxique mature]] |
| --------------------------------
| | }} |
| ----- 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
| |