This module is used to list all recipes in a particular category.
The type function will match recipes which have the type parameter set to the same value as the input.
Example[]
{{#invoke:recipe list|type|Foodstuff}}
, lists all recipes with type set to Foodstuff in Category:Foodstuff recipe.
Name | Ingredients | Crafting recipe | Description |
---|---|---|---|
Beetroot Soup | Beetroot + Bowl |
||
Bread | Wheat | ||
Cake | Milk Bucket + Sugar + Egg + Wheat |
Empty buckets remain in the crafting grid after crafting the cake. | |
Cookie | Wheat + Cocoa Beans |
||
Dried Kelp | Dried Kelp Block | ||
Golden Apple | Gold Ingot + Apple |
||
Golden Carrot | Gold Nugget + Carrot |
||
Honey Bottle | Glass Bottle + Honey Block |
||
Mushroom Stew | Red Mushroom + Brown Mushroom + Bowl |
||
Pumpkin Pie | Pumpkin + Sugar + Egg |
||
Rabbit Stew | Cooked Rabbit + Carrot + Baked Potato + Any Mushroom + Bowl |
||
Suspicious Stew | Red Mushroom + Brown Mushroom + Bowl + Any Flower |
[view | edit | history | purge]The above documentation is transcluded from Module:Recipe list/doc.
local p = {}
function p.type( f )
local args = f.args
local text = require( [[Module:Text]] )
local crafting = require( [[Module:Crafting]] ).table
local type = text.trim( args[1] )
local argList = {
'type', 'upcoming', 'name', 'ingredients', 'arggroups',
1, 2, 3, 4, 5, 6, 7, 8, 9,
'A1', 'B1', 'C1', 'A2', 'B2', 'C2', 'A3', 'B3', 'C3',
'Output', '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 = type .. ' recipe',
include = '{Crafting}:' .. table.concat( argList, ':' ),
mode = 'userformat',
secseparators = '====',
multisecseparators = '===='
} )
local out = {}
local showDesciption
local templates = {}
for template in 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 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].head = '1'
templates[1].showname = '1'
if showDescription and args.showdesciption ~= '0' or args.showdesciption == '1' then
templates[1].showdescription = '1'
end
if not args.continue then
templates[#templates].foot = '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