Модуль:Поиск шаблона страницы: различия между версиями
Материал из Space Station 14 Вики
Pok (обсуждение | вклад) Новая страница: «local p = {} function p.main(frame) local pageTitle = mw.title.getCurrentTitle() local content = pageTitle:getContent() if content and not content:match("строка") then return "Нет" end return "Да" end return p» |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 2: | Строка 2: | ||
function p.main(frame) | function p.main(frame) | ||
local args = frame.args | |||
local pattern = args[1] or "" | |||
local pageTitle = mw.title.getCurrentTitle() | local pageTitle = mw.title.getCurrentTitle() | ||
local content = pageTitle:getContent() | local content = pageTitle:getContent() | ||
if content and not content:match( | if content and not content:match(pattern) then | ||
return "Нет" | return "Нет" | ||
end | end | ||
Версия от 14:11, 6 марта 2025
Для документации этого модуля может быть создана страница Модуль:Поиск шаблона страницы/doc
local p = {}
function p.main(frame)
local args = frame.args
local pattern = args[1] or ""
local pageTitle = mw.title.getCurrentTitle()
local content = pageTitle:getContent()
if content and not content:match(pattern) then
return "Нет"
end
return "Да"
end
return p