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