mAucun résumé des modifications |
m (name -> nom) |
||
(11 versions intermédiaires par 3 utilisateurs non affichées) | |||
Ligne 2 : | Ligne 2 : | ||
function p.type( f ) |
function p.type( f ) |
||
local args = f.args |
local args = f.args |
||
− | local crafting = require( |
+ | local crafting = require( [[Module:Fabrication]] ).table |
local type = mw.text.trim( args[1] ) |
local type = mw.text.trim( args[1] ) |
||
Ligne 9 : | Ligne 9 : | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, |
1, 2, 3, 4, 5, 6, 7, 8, 9, |
||
'A1', 'B1', 'C1', 'A2', 'B2', 'C2', 'A3', 'B3', 'C3', |
'A1', 'B1', 'C1', 'A2', 'B2', 'C2', 'A3', 'B3', 'C3', |
||
− | 'résultat', 'description' |
+ | 'résultat', 'description', 'fixed', 'notfixed', |
+ | 'A1title', 'A1link', 'B1title', 'B1link', 'C1title', 'C1link', |
||
+ | 'A2title', 'A2link', 'B2title', 'B2link', 'C2title', 'C2link', |
||
+ | 'A3title', 'A3link', 'B3title', 'B3link', 'C3title', 'C3link', |
||
+ | 'Otitle', 'Olink', |
||
} |
} |
||
− | local data = f:callParserFunction( '#dpl', { |
+ | local data = f:callParserFunction( '#dpl:', { |
category = 'Recette ' .. type, |
category = 'Recette ' .. type, |
||
− | include = '{ |
+ | include = '{Fabrication}:' .. table.concat( argList, ':' ), |
mode = 'userformat', |
mode = 'userformat', |
||
secseparators = '====', |
secseparators = '====', |
Dernière version du 14 juin 2018 à 14:07
[créer | historique | purger]Documentation
Ce module n'a pas de documentation. Si vous savez comment l'utiliser, merci de la créer.local p = {}
function p.type( f )
local args = f.args
local crafting = require( [[Module:Fabrication]] ).table
local type = mw.text.trim( args[1] )
local argList = {
'type', 'à venir', 'nom', 'ingrédients',
1, 2, 3, 4, 5, 6, 7, 8, 9,
'A1', 'B1', 'C1', 'A2', 'B2', 'C2', 'A3', 'B3', 'C3',
'résultat', 'description', 'fixed', 'notfixed',
'A1title', 'A1link', 'B1title', 'B1link', 'C1title', 'C1link',
'A2title', 'A2link', 'B2title', 'B2link', 'C2title', 'C2link',
'A3title', 'A3link', 'B3title', 'B3link', 'C3title', 'C3link',
'Otitle', 'Olink',
}
local data = f:callParserFunction( '#dpl:', {
category = 'Recette ' .. type,
include = '{Fabrication}:' .. table.concat( argList, ':' ),
mode = 'userformat',
secseparators = '====',
multisecseparators = '===='
} )
local out = {}
local showDesciption
local templates = {}
for template in mw.text.gsplit( data, '====' ) do
-- If type matches
if template:find( '^%s*' .. type .. '%s*|' ) then
local tArgs = {}
local i = 0
-- Extract the arguments from the DPL query
for tArg in mw.text.gsplit( template, '\n|' ) do
i = i + 1
if tArg ~= '' then
local key = argList[i]
tArgs[key] = tArg
end
end
if tArgs.description then
showDescription = true
end
tArgs.nocat = '1'
table.insert( templates, tArgs )
end
end
if #templates == 0 then
return
end
templates[1].haut = '1'
templates[1].affichernom = '1'
if showDescription and args.afficherdescription ~= '0' or args.afficherdescription == '1' then
templates[1].afficherdescription = '1'
end
if not args.continue then
templates[#templates].bas = '1'
end
local out = {}
for i, v in ipairs( templates ) do
table.insert( out, crafting( v ) )
end
return table.concat( out, '\n' )
end
return p