Модуль:UserInfo: различия между версиями

Материал из Space Station 14 Вики
м (work then?)
м (whop)
Строка 23: Строка 23:
if t[i] == "Куратор вики" or t[i] == "куратор вики" then categories = categories.. "[[Категория:Кураторы раздела]]" end --Потом доделаю  
if t[i] == "Куратор вики" or t[i] == "куратор вики" then categories = categories.. "[[Категория:Кураторы раздела]]" end --Потом доделаю  
end
end
if categories == "" then categories = categories.. "[[Категория:Доступ к вики]]" end
return frame:preprocess(categories)
return frame:preprocess(categories)
end
end
return p
return p

Версия от 15:47, 20 апреля 2024

Для документации этого модуля может быть создана страница Модуль:UserInfo/doc

local p = {}
function p.getServersInfo(frame)
	local servers = frame.args[1]
	local categories = servers
	
	servers = servers:gsub(',', '}}\n*{{abb|')
	categories = categories:gsub(',', ']] [[Категория:Редактор ')
    
	return frame:preprocess('*{{abb|'.. servers.. '}} '.. '[[Категория:Редактор '.. categories.. ']]')
end

function p.getRolesInfo(frame)
	local roles = frame.args[1]
	t = {}
	for str in string.gmatch(roles, "([^, ]+)") do
		table.insert(t, str)
	end
	
	local categories = ""
	for i in pairs(t) do
		if t[i] == "Викидел" or t[i] == "викидел" or t[i] == "Кивикед" or t[i] == "кивикед" then categories = categories.. "[[Категория:Викиделы]]" end
		if t[i] == "лоровед" or t[i] == "Лоровед" or t[i] == "Лороед" or t[i] == "лороед" then categories = categories.. "[[Категория:Лороведы]]" end
		if t[i] == "Куратор вики" or t[i] == "куратор вики" then categories = categories.. "[[Категория:Кураторы раздела]]" end --Потом доделаю 
	end
	if categories == "" then categories = categories.. "[[Категория:Доступ к вики]]" end 
	return frame:preprocess(categories)
end
return p