Jump to content

Editing Module:Recipe

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 43: Line 43:
end
end


local function addUseCategory(category, name, quality, sort)
local function addUseCategory(category, name, sort)
if not name or tostring(name) == '' then
  if not name or tostring(name) == '' then
return
    return
end
  end


if quality and tostring(quality) ~= '' then
  if sort then
if sort and tostring(sort) ~= '' then
    category:wikitext('[[Category:Uses ', name, '|', sort, ']]')
category:wikitext('[[Category:Uses ', quality, '-Quality ', name, '|', sort, ']]')
  else
else
    category:wikitext('[[Category:Uses ', name, ']]')
category:wikitext('[[Category:Uses ', quality, '-Quality ', name, ']]')
  end
end
 
return
end
 
if sort and tostring(sort) ~= '' then
category:wikitext('[[Category:Uses ', name, '|', sort, ']]')
else
category:wikitext('[[Category:Uses ', name, ']]')
end
end
end


Line 85: Line 75:
     name = sName,
     name = sName,
     text = sAmt,
     text = sAmt,
     show_caption = '1'
     show_caption = '1',
    mobile = 'bulleted'
   }
   }


Line 97: Line 88:
     category,
     category,
     sName,
     sName,
    quality,
     padLeft(tostring(sAmt or ''):gsub('%D', ''), 10)
     padLeft(tostring(sAmt or ''):gsub('%D', ''), 10)
   )
   )
Line 109: Line 99:
     text = sText or '',
     text = sText or '',
     show_caption = '1',
     show_caption = '1',
    mobile = 'bulleted',
     mini = '1'
     mini = '1'
   }
   }
Line 136: Line 127:


local function renderHeader(args, output, category)
local function renderHeader(args, output, category)
   local header = output:tag('div'):addClass('recipe-header')
   local header = output:tag('div'):addClass('recipe_header')
   local sType = args[param.sTypeArg]
   local sType = args[param.sTypeArg]


   header:tag('span'):addClass('recipe-header-main')
   header:tag('span'):addClass('recipe_header_main')
     :tag('span'):addClass('recipe-header-text'):wikitext('[[' .. sType .. ']]'):done()
     :tag('span'):addClass('mobileHide'):wikitext('<big>' .. sType .. '</big>'):done()
    :tag('span'):addClass('mobileHide'):wikitext('<big>' .. sType .. '</big>'):done()
    :tag('span'):addClass('recipe_header_text'):wikitext('[[' .. sType .. ']]'):done()


   category:wikitext('[[Category:' .. sType .. ']]')
   category:wikitext('[[Category:' .. sType .. ']]')
Line 224: Line 217:
   end
   end


   header:tag('span'):addClass('recipe-header-sub')
   header:tag('span'):addClass('recipe_header_sub')
     :tag('span'):wikitext(' for '):done()
     :tag('span'):addClass('mobileHide'):wikitext(' for '):done()
     :tag('span'):addClass('recipe-header-text'):wikitext(sTime):done()
    :tag('span'):addClass('hidden'):wikitext(' for '):done()
     :tag('span'):addClass('recipe_header_text'):wikitext(sTime):done()
end
end


Line 236: Line 230:
   local sCharName = args[param.sCharArg]
   local sCharName = args[param.sCharArg]


   header:tag('span'):addClass('recipe-header-sub')
   header:tag('span'):addClass('recipe_header_sub')
     :tag('span'):wikitext('[[File:' .. sCharName .. ' Icon.png|24x24px|link=' .. sCharName .. ']]'):done()
     :tag('span'):addClass('mobileHide'):wikitext(' with '):done()
     :tag('span'):addClass('recipe-header-text'):wikitext('[[' .. sCharName .. ']]'):done()
    :tag('span'):addClass('hidden'):wikitext('[[File:' .. sCharName .. ' Icon.png|24x24px|link=' .. sCharName .. ']]'):done()
     :tag('span'):addClass('recipe_header_text'):wikitext('[[' .. sCharName .. ']]'):done()
end
end


Line 248: Line 243:
   local sKitchName = args[param.sKitchArg]
   local sKitchName = args[param.sKitchArg]


   header:tag('span'):addClass('recipe-header-sub')
   header:tag('span'):addClass('recipe_header_sub')
     :tag('span'):wikitext('[[File:' .. sKitchName .. ' Icon.png|24x24px|link=' .. sKitchName .. ']]'):done()
     :tag('span'):addClass('mobileHide'):wikitext(' with '):done()
     :tag('span'):addClass('recipe-header-text'):wikitext('[[' .. sKitchName .. ']]'):done()
    :tag('span'):addClass('hidden'):wikitext('[[File:' .. sKitchName .. ' Icon.png|24x24px|link=' .. sKitchName .. ']]'):done()
     :tag('span'):addClass('recipe_header_text'):wikitext('[[' .. sKitchName .. ']]'):done()
end
end


Line 278: Line 274:


   body
   body
     :tag('div'):addClass('recipe-body-icon')
     :tag('div'):addClass('recipe_body_icon')
       :wikitext('➜'):done()
       :wikitext('➜'):done()
     :tag('div'):addClass('recipe-body-yield')
     :tag('div'):addClass('recipe_body_yield')
       :node(yieldCard)
       :node(yieldCard)
end
end
Line 292: Line 288:
   renderCharacter(args, header)
   renderCharacter(args, header)


   local body = output:tag('div'):addClass('recipe-body')
   local body = output:tag('div'):addClass('recipe_body')


   local sSortDelim = param.sSortDelim
   local sSortDelim = param.sSortDelim
Line 400: Line 396:


local function renderCookingSplitTypeCard(category, body, ingredient)
local function renderCookingSplitTypeCard(category, body, ingredient)
  local qualityClass = getQualityClass(ingredient.quality or 'Gray')
local qualityClass = getQualityClass(ingredient.quality)


   local container = body:tag('span')
   local container = body:tag('span')
Line 464: Line 460:
local function renderCookingTypeFallback(category, body, ingredient)
local function renderCookingTypeFallback(category, body, ingredient)
   local wrapper = body:tag('div')
   local wrapper = body:tag('div')
     :addClass('recipe-body-cooking-ingredient')
     :addClass('recipe_body_cooking_ingredient')
     :addClass('recipe-body-cooking-type-cards')
     :addClass('recipe_body_cooking_type_cards')


   for _, typeName in ipairs(ingredient.types) do
   for _, typeName in ipairs(ingredient.types) do
Line 487: Line 483:
local function renderCookingOptionCards(category, body, ingredient)
local function renderCookingOptionCards(category, body, ingredient)
   local wrapper = body:tag('div')
   local wrapper = body:tag('div')
     :addClass('recipe-body-cooking-ingredient')
     :addClass('recipe_body_cooking_ingredient')
     :addClass('recipe-body-cooking-option-cards')
     :addClass('recipe_body_cooking_option_cards')


   for _, itemName in ipairs(ingredient.options) do
   for _, itemName in ipairs(ingredient.options) do
Line 522: Line 518:
   end
   end


   local sYield = args[param.sYieldArg] or nil
   local sYield = args[param.sYieldArg] or '1'
   local pageTitle = getCurrentPageName(args)
   local pageTitle = getCurrentPageName(args)


Line 528: Line 524:


   body
   body
     :tag('div'):addClass('recipe-body-icon')
     :tag('div'):addClass('recipe_body_icon')
       :wikitext('➜'):done()
       :wikitext('➜'):done()
     :tag('div'):addClass('recipe-body-yield')
     :tag('div'):addClass('recipe_body_yield')
       :node(yieldCard)
       :node(yieldCard)
end
end
Line 542: Line 538:


   local body = output:tag('div')
   local body = output:tag('div')
     :addClass('recipe-body')
     :addClass('recipe_body')
     :addClass('recipe-body-cooking')
     :addClass('recipe_body_cooking')


   local foundIngredient = false
   local foundIngredient = false
Line 583: Line 579:
function p._main(args, frame)
function p._main(args, frame)
   local output = mw.html.create('div')
   local output = mw.html.create('div')
     :addClass('recipe-container')
     :addClass('recipe_container')


   local category = mw.html.create()
   local category = mw.html.create()
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;