мНет описания правки |
@DeletedUser40298211 (обс. | вклад) м (оформление) |
||
Строка 15: | Строка 15: | ||
local text = { |
local text = { |
||
− | '<small> |
+ | '<small>– Это ' .. (typetable[mw.ustring.lower( type )] or 'неподписанные') .. ' сообщение было добавлено', |
'. Подписывайте свои сообщения с помощью ~~' .. nowiki .. '~~.</small><!-- Шаблон:' .. type .. ' -->' |
'. Подписывайте свои сообщения с помощью ~~' .. nowiki .. '~~.</small><!-- Шаблон:' .. type .. ' -->' |
||
} |
} |
Версия от 11:10, 18 апреля 2015
Переведено с соответствующего английского модуля.
p.unsigned
реализует {{unsigned}} и {{undated}}.
p.auto
реализует {{autoUnsigned}}.
Зависит от:
- Модуль:ProcessArgs (только
p.unsigned
) - Модуль:IPAddress
local p = {}
p.unsigned = function( f )
local args = require( 'Модуль:ProcessArgs' ).norm( f.args or f )
local type = args['тип'] or 'Unsigned'
local typetable = {unsigned = 'неподписанное', undated = 'не содержащее дату'} --добавлено в переводе
local user = args['участник']
local date = args['дата']
if date and not date:find( '%(UTC%)$' ) then
date = date .. ' (UTC)'
end
local nowiki = ''
if mw.isSubsting() then
nowiki = '<nowiki/>'
end
local text = {
'<small>– Это ' .. (typetable[mw.ustring.lower( type )] or 'неподписанные') .. ' сообщение было добавлено',
'. Подписывайте свои сообщения с помощью ~~' .. nowiki .. '~~.</small><!-- Шаблон:' .. type .. ' -->'
}
if date then
table.insert( text, 2, ' в ' .. date )
end
if user then
local userLinks
if not user:find( '[^:%x%.%d]' ) and require( 'Модуль:IPAddress' ).isIP( user ) then
userLinks = '[[Служебная:Вклад/' .. user .. '|' .. user .. ']] ([[Обсуждение участника:' .. user .. '|обс.]])'
else
userLinks = '[[Участник:' .. user .. '|' .. user .. ']] ([[Обсуждение участника:' .. user .. '|обс.]] • [[Служебная:Вклад/' .. user .. '|вклад]])'
end
table.insert( text, 2, ' участником ' .. userLinks )
end
if mw.isSubsting() then
-- Don't allow substitution with missing required arg
if type == 'Unsigned' and not user then
local dateArg = ''
if date then
dateArg = '||' .. date
end
return '{{Unsigned' .. dateArg .. '}}'
elseif type == 'Undated' and not date then
return '{{Undated}}'
end
elseif mw.title:getCurrentTitle().namespace ~= 10 then
if type == 'Unsigned' and not user then
table.insert( text, '[[Категория:Неправильное использование шаблона Unsigned]]' )
elseif type == 'Undated' and not date then
table.insert( text, '[[Категория:Неправильное использование шаблона Undated]]' )
end
table.insert( text, '[[Категория:Страницы с требующими подстановки шаблонами]]' )
end
return table.concat( text )
end
return p