Module:Sandbox/User:The Gaffer/Modules/Infobox Recipe: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
Line 5: Line 5:
local args = frame:getParent().args
local args = frame:getParent().args
local mw = require('mw')
local mw = require('mw')
local currency = require('Module:Currency').parse


-- Define raw material costs based on Semantic MediaWiki queries
-- Define raw material costs based on Semantic MediaWiki queries
Line 54: Line 55:
table.insert(out, '| [[' .. args.rawmat1 .. ']]')
table.insert(out, '| [[' .. args.rawmat1 .. ']]')
table.insert(out, '| style="text-align: right;" | ' .. (args.rawmat1qty or 1))
table.insert(out, '| style="text-align: right;" | ' .. (args.rawmat1qty or 1))
table.insert(out, '| style="text-align: right;" | ' .. rawmat1cost)
table.insert(out, '| style="text-align: right;" | ' .. currency(rawmat1cost))
table.insert(out, '|-')
table.insert(out, '|-')
end
end
Line 61: Line 62:
table.insert(out, '| [[' .. args.rawmat2 .. ']]')
table.insert(out, '| [[' .. args.rawmat2 .. ']]')
table.insert(out, '| style="text-align: right;" | ' .. (args.rawmat2qty or 1))
table.insert(out, '| style="text-align: right;" | ' .. (args.rawmat2qty or 1))
table.insert(out, '| style="text-align: right;" | ' .. rawmat2cost)
table.insert(out, '| style="text-align: right;" | ' .. currency(rawmat2cost))
table.insert(out, '|-')
table.insert(out, '|-')
end
end
Line 68: Line 69:
table.insert(out, '| [[' .. args.rawmat3 .. ']]')
table.insert(out, '| [[' .. args.rawmat3 .. ']]')
table.insert(out, '| style="text-align: right;" | ' .. (args.rawmat3qty or 1))
table.insert(out, '| style="text-align: right;" | ' .. (args.rawmat3qty or 1))
table.insert(out, '| style="text-align: right;" | ' .. rawmat3cost)
table.insert(out, '| style="text-align: right;" | ' .. currency(rawmat3cost))
table.insert(out, '|-')
table.insert(out, '|-')
end
end