Модуль:Meals Lookup: различия между версиями
Mhamster (обсуждение | вклад) Нет описания правки |
Mhamster (обсуждение | вклад) getimage, images |
||
| Строка 25: | Строка 25: | ||
end | end | ||
end | end | ||
end | |||
return out | |||
end | |||
function getimage(frame, fileid) -- should not be invoked | |||
local out = "" | |||
local gifFileTitle = mw.title.new( "File:" .. fileid .. ".gif" ) | |||
local pngFileTitle = mw.title.new( "File:" .. fileid .. ".png" ) | |||
if gifFileTitle.file.exists then | |||
out = "File:" .. fileid .. ".gif" | |||
elseif pngFileTitle.file.exists then | |||
out = "File:" .. fileid .. ".png" | |||
else | |||
out = "" | |||
end | end | ||
return out | return out | ||
| Строка 34: | Строка 48: | ||
out = out .. | out = out .. | ||
frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | ||
solid .. "}}|image= | solid .. "}}|image=" .. getimage(frame, solid) .. "|amount=" .. amount .. "}}") | ||
end | end | ||
return out | return out | ||
| Строка 295: | Строка 309: | ||
function p.tests(frame) | function p.tests(frame) | ||
local out = "" | local out = "" | ||
out = out .. p.buildmicrowaverecipes(frame) | -- out = out .. p.buildmicrowaverecipes(frame) | ||
out = out .. p.buildslicerecipes(frame) | -- out = out .. p.buildslicerecipes(frame) | ||
out = out .. p.buildgrindrecipes(frame) | -- out = out .. p.buildgrindrecipes(frame) | ||
out = out .. p.buildheatrecipes(frame) | -- out = out .. p.buildheatrecipes(frame) | ||
out = out .. p.buildtoolmaderecipes(frame) | -- out = out .. p.buildtoolmaderecipes(frame) | ||
out = out .. p.buildixablerecipes(frame) | -- out = out .. p.buildixablerecipes(frame) | ||
-- out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildmicrowaverecipebox|" .. frame.args[1] .. "}}") | -- out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildmicrowaverecipebox|" .. frame.args[1] .. "}}") | ||
-- out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildslicerecipebox|" .. frame.args[2] .. "}}") | -- out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildslicerecipebox|" .. frame.args[2] .. "}}") | ||