Jump to content

Editing Module:Item Usage

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision Your text
Line 127: Line 127:
end
end


-- Multiple kitchenware:
-- Multiple kitchenware, in case you later use:
-- |kitchenware_1 =
-- |kitchenware_1 =
-- |kitchenware_2 =
-- |kitchenware_2 =
Line 267: Line 267:


return nil
return nil
end
local function renderCookingKitchenware(recipe)
local kitchenwareArg = getKitchenwareArg()
local kitchenware = {}
if isNotEmpty(recipe[kitchenwareArg]) then
table.insert(kitchenware, renderIconLink(recipe[kitchenwareArg]))
end
local index = 1
while isNotEmpty(recipe[kitchenwareArg .. '_' .. index]) do
table.insert(kitchenware, renderIconLink(recipe[kitchenwareArg .. '_' .. index]))
index = index + 1
end
if #kitchenware == 0 then
return nil
end
return '<b>Kitchenware:</b> ' .. table.concat(kitchenware, ' / ')
end
end


Line 281: Line 303:
end
end


return ingredients
local kitchenware = renderCookingKitchenware(recipe)
end
 
local function renderCookingKitchenware(recipe)
local kitchenwareArg = getKitchenwareArg()
local kitchenware = {}


if isNotEmpty(recipe[kitchenwareArg]) then
if isNotEmpty(kitchenware) then
table.insert(kitchenware, renderIconLink(recipe[kitchenwareArg]))
table.insert(ingredients, kitchenware)
end
end


local index = 1
return ingredients
 
while isNotEmpty(recipe[kitchenwareArg .. '_' .. index]) do
table.insert(kitchenware, renderIconLink(recipe[kitchenwareArg .. '_' .. index]))
index = index + 1
end
 
return kitchenware
end
end


Line 308: Line 318:


return renderStandardIngredients(recipe)
return renderStandardIngredients(recipe)
end
local function hasCookingRecipes(valids)
for _, recipes in pairs(valids) do
for _, recipe in pairs(recipes) do
if isCookingRecipe(recipe) then
return true
end
end
end
return false
end
end


Line 400: Line 398:
function p._main(valids, craftType)
function p._main(valids, craftType)
local _table = mw.html.create('table'):addClass('wikitable article-table sortable')
local _table = mw.html.create('table'):addClass('wikitable article-table sortable')
local showKitchenware = hasCookingRecipes(valids)


-- Header row
-- Header row
Line 406: Line 403:
tr:tag('th'):wikitext('Item')
tr:tag('th'):wikitext('Item')
tr:tag('th'):wikitext('Craft Type')
tr:tag('th'):wikitext('Craft Type')
if showKitchenware then
tr:tag('th'):wikitext('Kitchenware')
end
tr:tag('th'):wikitext(craftType == 'Furnishing Set' and 'Components' or 'Recipe')
tr:tag('th'):wikitext(craftType == 'Furnishing Set' and 'Components' or 'Recipe')


Line 451: Line 443:
:css{['text-align'] = 'center'}
:css{['text-align'] = 'center'}
:wikitext('[[', recipe[Rlib.sTypeArg], ']]')
:wikitext('[[', recipe[Rlib.sTypeArg], ']]')
if showKitchenware then
if isCookingRecipe(recipe) then
local kitchenware = renderCookingKitchenware(recipe)
tr:tag('td'):wikitext(table.concat(kitchenware, '<br>'))
else
tr:tag('td'):wikitext('—')
end
end


local ingredients = renderRecipeIngredients(recipe)
local ingredients = renderRecipeIngredients(recipe)
Please note that all contributions to The Petit Planet Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see Petit Planet Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template
Below are commonly used wikitext from MediaWiki:Edittools. Click on any to insert them in the edit box.
File Pages==Summary====Licensing=={{Fairuse}}{{File|}}
Dynamic Page List¦²«»²{¦}²«»«/»«!----»
Array in DPL¹^2{}^2^2{¹}^2
Parser Functions{{#if:||}}
{{#ifeq:|||}}
{{#expr:}}
{{#switch:||#default=}}
{{#replace:||}}
{{#titleparts:}}
{{#tag:|}}
Markup{{}}|[][[]][[Category:]]#REDIRECT [[]] [[Category:Redirect Pages]]<code></code><includeonly></includeonly><noinclude></noinclude><nowiki></nowiki><!----><br>§
Notices{{Stub|}}{{Stub Dialogue}}{{Upcoming}}{{Under Construction}}{{Placeholder|}}
Magic Words{{!}}{{formatnum:}}{{lc:}}{{uc:}}{{PAGENAME}}{{FULLPAGENAME}}{{ROOTPAGENAME}}{{BASEPAGENAME}}{{SUBPAGENAME}}{{DISPLAYTITLE:|noreplace}}__TOC____NOTOC____EXPECTUNUSEDCATEGORY____HIDDENCAT__
HTML Entities&mdash;&nbsp;&comma;&shy;