Модуль:Фото
Для документации этого модуля может быть создана страница Модуль:Фото/doc
local p = {}
local function get_files(args)
local files = {}
for n = 1, 100 do
local key = n == 1 and 'Фото' or ('Фото' .. n)
local v = args[key]
if v == nil or v == '' then
if n > 1 then
break
end
else
for f in mw.text.gsplit(v, ',', true) do
f = mw.text.trim(f)
if f ~= '' then
table.insert(files, f)
end
end
end
end
return files
end
function p.main(frame)
local parent = frame:getParent()
local args = parent and parent.args or frame.args
local width = args['Ширина'] or '220'
local height = args['Высота'] or '160'
local files = get_files(args)
local out = {}
for _, f in ipairs(files) do
table.insert(out, string.format('[[Файл:%s|%sx%spx]]', f, width, height))
end
return table.concat(out, '\n')
end
return p