Editing Module:Infobox Recipe/Sandbox

Jump to navigation Jump to search
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 85: Line 85:


--Set SMW properties
--Set SMW properties
for _,material in ipairs(argsMaterials) do
local smw_properties = {
mw.smw.set({
['Uses item'] = {},
['Uses item and quantity'] = {},
["Uses item"] = material.name,
["Uses item_and_quantity"] = material.name .. ',' .. tostring(material.quantity)
-- these are for when a recipe is called by a subsequent recipe that uses showFull
})
['Uses facility'] = args.facility,
-- not implemented yet, for adding to duration 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
end

-- these are for when a recipe is called by a subsequent recipe that uses showFull
mw.smw.set(smw_properties)
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.
--Creates a row suitable for the raw materials section of the infobox.
Line 141: Line 147:
:tag('td')
:tag('td')
:attr{ colspan = '10' }
:attr{ colspan = '10' }
:css{ ['text-align'] = 'center' }
:css{ ['text-align'] = 'left' }
:wikitext('[[File:' .. facility .. '.png|30px|link=' .. facility .. ']] [[' .. facility .. ']]')
:wikitext('[[File:' .. facility .. '.png|30px|link=' .. facility .. ']] [[' .. facility .. ']]')
:done()
:done()
Line 165: Line 171:
:tag('td')
:tag('td')
:attr{ colspan = '11' }
: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)"))
:wikitext(hc(args.facility) and ('[[File:%s.png|link=%s|30px]] [[%s]]'):format(args.facility, args.facility, args.facility) or editButton("'''?''' (edit)"))


Line 173: Line 178:
:tag('th')
:tag('th')
:attr{ colspan = '2' }
:attr{ colspan = '2' }
:wikitext('Duration')
:wikitext('Time')
:done()
:done()
:tag('td')
:tag('td')
:attr{ colspan = '11' }
:attr{ colspan = '11' }
:wikitext(hc(args.duration) and ('%s s'):format(args.duration) or editButton("'''?''' (edit)"))
:css{ ['text-align'] = 'center' }
:wikitext(hc(args.duration) and ('%ss'):format(args.duration) or editButton("'''?''' (edit)"))


:done()
:done()
Line 191: Line 195:
:done()
:done()
:tag('th')
:tag('th')
:attr{ colspan = '5' }
:attr{ colspan = '10' }
:wikitext('KP')
:done()
:tag('th')
:attr{ colspan = '5' }
:wikitext('XP')
:wikitext('XP')
:done()
:done()
Line 210: Line 210:
:done()
:done()
:tag('td')
:tag('td')
:attr{ colspan = '5' }
:attr{ colspan = '10' }
: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' }
:css{ ['text-align'] = 'center' }
:wikitext(hc(args.exp) and (args.exp) or editButton("'''?''' (edit)"))
:wikitext(hc(args.exp) and (args.exp) or editButton("'''?''' (edit)"))
Please note that all contributions to Brighter Shores Wiki are considered to be released under the CC BY-NC-SA 3.0 (see Brighter Shores: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

Template used on this page: