Модуль:Поиск шаблона страницы: различия между версиями
Материал из Space Station 14 Вики
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| (не показаны 2 промежуточные версии этого же участника) | |||
| Строка 14: | Строка 14: | ||
local content = title:getContent() or "" | local content = title:getContent() or "" | ||
local pattern = "%s*{{ | local pattern = "[\n]%s*{{" .. modName | ||
if string.match("\n" .. content, pattern) then | |||
if string. | |||
return "Да" | return "Да" | ||
else | else | ||
Текущая версия от 04:13, 15 апреля 2025
Для документации этого модуля может быть создана страница Модуль:Поиск шаблона страницы/doc
local p = {}
function p.main(frame)
local modName = frame.args[1]
if not modName then
return "Параметр не задан"
end
local title = mw.title.getCurrentTitle()
if not title then
return "Не удалось получить заголовок страницы"
end
local content = title:getContent() or ""
local pattern = "[\n]%s*{{" .. modName
if string.match("\n" .. content, pattern) then
return "Да"
else
return "Нет"
end
end
return p