Модуль:Поиск шаблона страницы
Материал из Space Station 14 Вики
Версия от 14:33, 6 марта 2025; Pok (обсуждение | вклад)
Для документации этого модуля может быть создана страница Модуль:Поиск шаблона страницы/doc
local p = {}
function p.main(frame)
local args = frame.args
local searchText = args[1] or ""
searchText = searchText:gsub("^<nowiki>(.-)</nowiki>$", "%1")
local title = mw.title.getCurrentTitle()
local content = title:getContent()
if not content then
return "Нет"
end
local cleanedContent = content:gsub("{{#invoke:Поиск строк страницы|main|[^}]+}}", "")
cleanedContent = cleanedContent:gsub("<code>.-</code>", "")
cleanedContent = cleanedContent:gsub("<nowiki>.-</nowiki>", "")
if not cleanedContent:match(searchText) then
return "Нет"
end
return "Да"
end
return p