Модуль:Песочница/Wikisaurus/football
Перейти к навигации
Перейти к поиску
Документация
local p = {} -- p stands for package
function p.main (frame)
local types = mw.text.split(frame.args['тип'], ', ')
if #types == 1 and types[1] == '' then
types = {}
end
local is_footballer = false
local is_manager = false
local is_referee = false
local has_error = false
local res = ''
for _, type in pairs(types) do
if type == 'футболист' then
is_footballer = true
elseif type == 'тренер' then
is_manager = true
elseif type == 'судья' then
is_referee = true
else
has_error = true
end
end
if frame.args['футболист'] ~= '' then
is_footballer = true
end
if frame.args['тренер'] ~= '' then
is_manager = true
end
if frame.args['судья'] ~= '' then
is_referee = true
end
if not is_footballer and not is_manager and not is_referee then
has_error = true
end
if is_footballer then
res = res .. '[[:Категория:Футболисты по алфавиту]]'
end
if is_manager then
res = res .. '[[:Категория:Футбольные тренеры по алфавиту]]'
end
if is_referee then
res = res .. '[[:Категория:Футбольные судьи по алфавиту]]'
end
if has_error then
res = res .. '[[:Категория:Футбольные персоналии с проблемами в указании типа]]'
end
return res
end
return p