Модуль:Поиск шаблона страницы: различия между версиями

мНет описания правки
мНет описания правки
Строка 6: Строка 6:


     searchText = searchText:match("^%s*(.-)%s*$")
     searchText = searchText:match("^%s*(.-)%s*$")
     searchText = searchText:gsub("<nowiki>(.-)</nowiki>", "%1")
     searchText = searchText:gsub("<nowiki>(.-)</nowiki>", "%1")


Строка 20: Строка 19:


     local cleanedContent = content:gsub("{{#invoke:Поиск строк страницы|main|[^}]+}}", "")
     local cleanedContent = content:gsub("{{#invoke:Поиск строк страницы|main|[^}]+}}", "")
 
     local pattern = "(^|[^%wА-Яа-яёЁ])" .. searchText .. "($|[^%wА-Яа-яёЁ])"
     local pattern = "([^%wА-Яа-яёЁ])" .. searchText .. "([^%wА-Яа-яёЁ])"
      
      
     if not cleanedContent:match(pattern) then
     if not cleanedContent:match(pattern) then