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

мНет описания правки
мНет описания правки
Строка 9: Строка 9:
local target, display
local target, display


if mw.ustring.sub(text, 1, 1) == ":" then
-- Если первая буква равна ":"
target = mw.ustring.sub(text, 2)
if text:sub(1,1) == ":" then
target = text:sub(2)
display = text
display = text
-- Если строка начинается с "Модуль:"
elseif mw.ustring.sub(text, 1, 7) == "Модуль:" then
elseif mw.ustring.sub(text, 1, 7) == "Модуль:" then
target = "#invoke:" .. mw.ustring.sub(text, 8)
target = "#invoke:" .. mw.ustring.sub(text, 8)
Строка 19: Строка 22:
elseif text:sub(1,7) == "Шаблон:" then
elseif text:sub(1,7) == "Шаблон:" then
target = text
target = text
-- Для отображения убираем префикс "Шаблон:"
display = text:sub(8)
display = text:sub(8)