Module:Infobox Recipe/Sandbox: Difference between revisions

set to current version of main infobox
No edit summary
(set to current version of main infobox)
 
(4 intermediate revisions by the same user not shown)
Line 85:
 
--Set SMW properties
local smw_properties = {
for _,material in ipairs(argsMaterials) do
['Uses item'] = {},
mw.smw.set({
["'Uses item" and quantity'] = material.name{},
-- these are for when a recipe is called by a subsequent recipe that uses showFull
["Uses item_and_quantity"] = material.name .. ',' .. tostring(material.quantity)
["'Uses facility"'] = args.facility,
})
-- not implemented yet, for addinadding to timeduration if showfull is true
["'Uses duration"'] = args.duration,
}
for _, material in ipairs(argsMaterials) do
table.insert(smw_properties['Uses item'], material.name)
table.insert(smw_properties['Uses item and quantity'], ('%s,%s'):format(material.name, material.quantity))
end
 
mw.smw.set(smw_properties)
-- these are for when a recipe is called by a subsequent recipe that uses showFull
if args.facility then
mw.smw.set({
["Uses facility"] = args.facility
})
end
-- not implemented yet, for addin to time if showfull is true
if args.duration then
mw.smw.set({
["Uses duration"] = args.duration
})
end
 
--Creates a row suitable for the raw materials section of the infobox.
Line 147 ⟶ 141:
:tag('td')
:attr{ colspan = '10' }
:css{ ['text-align'] = 'leftcenter' }
:wikitext('[[File:' .. facility .. '.png|30px|link=' .. facility .. ']] [[' .. facility .. ']]')
:done()
Line 171 ⟶ 165:
:tag('td')
:attr{ colspan = '11' }
:css{ ['text-align'] = 'center' }
:wikitext(hc(args.facility) and ('[[File:%s.png|link=%s|30px]] [[%s]]'):format(args.facility, args.facility, args.facility) or editButton("'''?''' (edit)"))
 
Line 178 ⟶ 173:
:tag('th')
:attr{ colspan = '2' }
:wikitext('TimeDuration')
:done()
:tag('td')
:attr{ colspan = '11' }
:css{ ['text-align'] = 'center' }
:wikitext(hc(args.duration) and ('%s sss'):format(args.duration) or editButton("'''?''' (edit)"))
 
:done()
Line 195 ⟶ 191:
:done()
:tag('th')
:attr{ colspan = '105' }
:wikitext('KP')
:done()
:tag('th')
:attr{ colspan = '5' }
:wikitext('XP')
:done()
Line 210:
:done()
:tag('td')
:attr{ colspan = '105' }
:css{ ['text-align'] = 'center' }
:wikitext(hc(args.kp) and ('%s%%'):format(args.kp) or editButton("'''?''' (edit)"))
:done()
:tag('td')
:attr{ colspan = '5' }
:css{ ['text-align'] = 'center' }
:wikitext(hc(args.exp) and (args.exp) or editButton("'''?''' (edit)"))
11,271

edits