Модуль:ProcessCastes
Перейти к навигации
Перейти к поиску
Для документации этого модуля может быть создана страница Модуль:ProcessCastes/doc
local p = {}
function p.process(frame)
local castes = frame.args[1] or ""
local result = ""
for caste in string.gmatch(castes, '([^,]+)') do
result = result .. frame:expandTemplate{title = "Caste", args = {caste:match("^%s*(.-)%s*$")}}
end
return result
end
function p.countCastes(frame)
local castes = frame.args[1] or ""
local count = 0
for _ in string.gmatch(castes, '([^,]+)') do
count = count + 1
end
return count
end
function p.categorize(frame)
local castes = frame.args.castes or ""
local result = ""
for caste in string.gmatch(castes, '([^,]+)') do
local translatedCaste = frame:preprocess("{{#invoke:Caste|getCaste|" .. caste .. "|ru}}")
result = result .. "[[Category:Муравей Касты " .. translatedCaste .. "]]\n"
end
return result
end
return p