Module:Recipe
Documentation for this module may be created at Module:Recipe/doc
local p = {}
local param = {
station = 'station',
sort = 'sort',
sortDelim = ';',
sortDelim2 = '¤',
time = 'time',
output = 'output',
yield = 'yield',
page = 'page'
}
local function addRecipe(name, amt)
if not name or not amt then return "" end
return '[[' .. name .. ']] x ' .. amt
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame)
local t = mw.html.create('table')
:addClass('fandom-table article-table sortable alternating-colors-table')
local inputText = ""
for k, v in pairs(args) do
local isReserved = false
for _, key in pairs(param) do
if k == key then
isReserved = true
break
end
end
if not isReserved then
inputText = inputText .. addRecipe(k, v) .. "<br/>"
end
end
t:tag('tr')
:tag('td'):wikitext(inputText ~= "" and inputText or "-")
t:tag('tr'):tag('td'):wikitext(args.station and ('[[' .. args.station .. ']]') or "-")
t:tag('tr'):tag('td'):wikitext(args.time or "-")
t:tag('tr'):tag('td'):wikitext(args.output and ('[[' .. args.output .. ']] x ' .. (args.yield or 1)) or "-")
return t
end
return p