Модуль:Unsigned: различия между версиями
Перейти к навигации
Перейти к поиску
[отпатрулированная версия] | [отпатрулированная версия] |
Содержимое удалено Содержимое добавлено
Iniquity (обсуждение | вклад) отмена правки 113990054 участника Jaguar K (обс.) ломаются обычные ссылки, пожалуйста, тестируйте перед употреблением в песочнице Метка: отмена |
Jaguar K (обсуждение | вклад) Проверено в песочнице. Спасибо 194.104.22.125 за решение. |
||
Строка 16: | Строка 16: | ||
moment = arg2 |
moment = arg2 |
||
end |
end |
||
moment = mw.text.trim(moment) -- два пробела L-39 ломают «Инструменты обсуждения» |
|||
end |
end |
||
agent = mw.text.trim(agent) -- пробел в начале ломает ip: Special:Contributions/_ip |
|||
if agent == nil or agent == '' then |
if agent == nil or agent == '' then |
||
Строка 35: | Строка 37: | ||
if moment ~= nil and moment ~= '' then |
if moment ~= nil and moment ~= '' then |
||
if not mw.ustring.match(moment, '(UTC)') then |
if not mw.ustring.match(moment, '(UTC)') then |
||
moment = moment .. ' (UTC)' |
moment = moment .. ' (UTC)' -- L-39 |
||
end |
end |
||
res = res .. ' ' .. |
res = res .. ' ' .. moment |
||
end |
end |
||
Версия от 07:16, 4 мая 2021
local p = {} -- p stands for package
function p.main (frame)
local arg1 = mw.ustring.gsub(frame:getParent().args[1] or '', '\226\128\142', '') -- invisible ‎ mark
local arg2 = mw.ustring.gsub(frame:getParent().args[2] or '', '\226\128\142', '') -- invisible ‎ mark
local agent, moment
if arg2 == nil or arg2 == '' then
agent = arg1
else
if mw.ustring.match(arg1, '[0-9]+ [а-я]+ 20[0-9]+') then
agent = arg2
moment = arg1
else
agent = arg1
moment = arg2
end
moment = mw.text.trim(moment) -- два пробела L-39 ломают «Инструменты обсуждения»
end
agent = mw.text.trim(agent) -- пробел в начале ломает ip: Special:Contributions/_ip
if agent == nil or agent == '' then
return '<span class="error">Unsigned: введены некорректные параметры</span>'
end
local res = '<small class="autosigned"> — \'\'Эта [[ВП:Подписывайтесь на страницах обсуждения|реплика]] добавлена '
if mw.ustring.match(agent, '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$')
or mw.ustring.match(agent, '^[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+$')
or mw.ustring.match(agent, '^[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+$') then
res = res .. 'с IP [[Special:Contributions/' .. agent .. '|' .. agent .. ']] ({{фиттс|User talk:' .. agent .. '|о}})'
else
res = res .. 'участником [[User:' .. agent .. '|' .. agent .. ']] ({{фиттс|User talk:'
.. agent .. '|о}} • {{фиттс|Special:Contributions/' .. agent .. '|в}})'
end
if moment ~= nil and moment ~= '' then
if not mw.ustring.match(moment, '(UTC)') then
moment = moment .. ' (UTC)' -- L-39
end
res = res .. ' ' .. moment
end
res = res .. '\'\'</small>'
return frame:preprocess(res)
end
return p