Module:Recipe: Difference between revisions

No edit summary
No edit summary
Line 6: Line 6:
local param = {
local param = {
   sCharArg = 'character',
   sCharArg = 'character',
  sKitchArg = 'kitchenware',
   sTypeArg = 'type',
   sTypeArg = 'type',
   sSortArg = 'sort',
   sSortArg = 'sort',
Line 477: Line 478:
end
end
--]]
--]]
local function renderKitchenwareSlot(category, body, args)
local function renderKitchenWareSlot(args, header)
   local kitchenware = getKitchenware(args)
   if type(args[param.sKitchArg]) ~= 'string' then
 
  if #kitchenware == 0 then
    body:tag('div')
      :addClass('recipe_body_icon')
      :wikitext('➜')
 
     return
     return
   end
   end


   local slot = body:tag('div')
   local sKitchName = args[param.sKitchArg]
    :addClass('recipe_body_icon')
    :addClass('recipe_header_sub')


   for i, kitchenwareName in ipairs(kitchenware) do
   header:tag('span'):addClass('recipe_header_sub')
    if i > 1 then
     :tag('span'):addClass('mobileHide'):wikitext(' with '):done()
      slot:tag('span')
    :tag('span'):addClass('hidden'):wikitext('[[File:' .. sKitchName .. ' Icon.png|24x24px|link=' .. sKitchName .. ']]'):done()
        :addClass('recipe_header_text')
    :tag('span'):addClass('recipe_header_text'):wikitext('[[' .. sKitchName .. ']]'):done()
        :wikitext(' / ')
        :done()
    end
 
     slot
      :tag('span'):addClass('mobileHide')
        :wikitext('[[File:Icon_' .. kitchenwareName .. '.png|35x35px|link=' .. kitchenwareName .. ']]'):done()
      :tag('span'):addClass('hidden')
        :wikitext('[[File:Icon_' .. kitchenwareName .. '.png|35x35px|link=' .. kitchenwareName .. ']]'):done()
      :tag('span'):addClass('recipe_header_text')
        :wikitext('[[' .. kitchenwareName .. ']]'):done()
 
    addUseCategory(category, kitchenwareName)
  end
end
end