Module:Infobox Recipe: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(Switch to mw.html fluent builder; Use {{Currency cell}} to align currency)
(Link all images to the item/facility; Get rid of border between item image and name)
Line 1: Line 1:
local currency = require('Module:Currency')
local currency = require('Module:Currency')
local parse = require('Module:Param Parse')
local yn = require('Module:Yesno')


local function currency_cell(amount)
local function currency_cell(amount)
Line 9: Line 11:
function p._main(frame)
function p._main(frame)
local args = frame:getParent().args
local args = frame:getParent().args
local parse = require('Module:Param Parse')
local yn = require('Module:Yesno')


--If set to true, will check if any of the items passed as a rawmaterialparam are actually intermediate materials. Will then change the display order of the infobox.
--If set to true, will check if any of the items passed as a rawmaterialparam are actually intermediate materials. Will then change the display order of the infobox.
Line 93: Line 93:
return mw.html.create('tr')
return mw.html.create('tr')
:tag('td')
:tag('td')
:css{ ['border-right'] = 'none' }
:wikitext('[[File:' .. item.name .. '.png|30px]]')
:wikitext('[[File:' .. item.name .. '.png|30px|link=' .. item.name .. ']]')
:done()
:done()
:tag('td')
:tag('td')
:css{ ['border-left'] = 'none' }
:wikitext('[[' .. item.name .. ']]')
:wikitext('[[' .. item.name .. ']]')
:done()
:done()
Line 111: Line 113:
return mw.html.create('tr')
return mw.html.create('tr')
:tag('td')
:tag('td')
:css{ ['border-right'] = 'none' }
:wikitext('[[File:' .. item .. '.png|30px]]')
:wikitext('[[File:' .. item .. '.png|30px|link=' .. item .. ']]')
:done()
:done()
:tag('td')
:tag('td')
:css{ ['border-left'] = 'none' }
:wikitext('[[' .. item .. ']]')
:wikitext('[[' .. item .. ']]')
:done()
:done()
Line 123: Line 127:
:attr{ colspan = '10' }
:attr{ colspan = '10' }
:css{ ['text-align'] = 'right' }
:css{ ['text-align'] = 'right' }
:wikitext('[[File:' .. facility .. '.png|30px]] [[' .. facility .. ']]')
:wikitext('[[File:' .. facility .. '.png|30px|link=' .. facility .. ']] [[' .. facility .. ']]')
:done()
:done()
:done()
:done()
Line 144: Line 148:
:tag('td')
:tag('td')
:attr{ colspan = '11' }
:attr{ colspan = '11' }
:wikitext(args.facility and '[[' .. args.facility .. ']]' or 'Unknown')
:wikitext(args.facility and ('[[File:%s.png|link=%s|30px]] [[%s]]'):format(args.facility, args.facility, args.facility) or 'Unknown')
:done()
:done()
:done()
:done()
Line 253: Line 257:
:tag('tr')
:tag('tr')
:tag('td')
:tag('td')
:css{ ['border-right'] = 'none' }
:wikitext('[[File:' .. args.output1 .. '.png|30px]]')
:wikitext('[[File:' .. args.output1 .. '.png|30px|link=' .. args.output1 .. ']]')
:done()
:done()
:tag('td')
:tag('td')
:css{ ['border-left'] = 'none' }
:wikitext(args.output1 and '[[' .. args.output1 .. ']]' or 'Unknown')
:wikitext(args.output1 and '[[' .. args.output1 .. ']]' or 'Unknown')
:done()
:done()