Модуль:Поиск шаблона страницы: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 6: | Строка 6: | ||
searchText = searchText:match("^%s*(.-)%s*$") | searchText = searchText:match("^%s*(.-)%s*$") | ||
searchText = mw.text.decode(searchText) | |||
searchText = searchText:gsub("<nowiki>(.-)</nowiki>", "%1") | searchText = searchText:gsub("<nowiki>(.-)</nowiki>", "%1") | ||
| Строка 15: | Строка 17: | ||
local title = mw.title.getCurrentTitle() | local title = mw.title.getCurrentTitle() | ||
local content = title:getContent() | local content = title:getContent() | ||
if not content then | if not content then | ||
return "Нет" | return "Нет" | ||
| Строка 23: | Строка 26: | ||
local escapedSearchText = mw.ustring.gsub(searchText, "([%(%)%.%%%+%-%*%?%[%]%^%$])", "%%%1") | local escapedSearchText = mw.ustring.gsub(searchText, "([%(%)%.%%%+%-%*%?%[%]%^%$])", "%%%1") | ||
if not mw.ustring. | if not mw.ustring.find(content, escapedSearchText, 1, true) then | ||
return "Нет" | return "Нет" | ||
end | end | ||