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