Изменения
Перейти к навигации
Перейти к поиску
Строка 39:
Строка 39:
− +
− +
− +
− +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
− +
− +
− +
Строка 55:
Строка 71:
− local delink = require( 'Module:Delink' )._delink +
− comment = delink( { comment } )+
− if comment then+
− local html = mw.html.create( 'span' )
− :attr( 'title', comment )
− :wikitext( text )
− if hasComment then+
− html:attr( 'style', 'border-bottom:1px dotted;' )+
− end
−
− text = tostring( html )
+
+
Строка 182:
Строка 194:
− +
− if not isEmpty( comment ) then
− comment = comment .. getDate( date )
− end
Модуль:Надстрочное предупреждение (посмотреть исходный код)
Версия от 18:33, 16 мая 2023
, 2 года назадупрощение обработки комментариев
end
end
-- Форматирование даты как в шаблоне
-- Форматирование комментария как в шаблоне
local function getDate( date )
local function getComment( comment, link, date )
if isEmpty( date ) then
if isEmpty( comment ) and isEmpty( date ) then
return ''
return nil
end
-- «Википедия:Нейтральная точка зрения (2 мая 2015)»
if isEmpty( comment ) and not isEmpty( date ) then
comment = link
end
if isEmpty( comment ) then
return nil
end
local delink = require( 'Module:Delink' )._delink
comment = delink( { comment } )
if not isEmpty( date ) then
comment = comment .. mwLang:formatDate( ' (j xg Y)', date )
end
end
return mwLang:formatDate( ' (j xg Y)', date )
return comment
end
end
-- Форматирование ссылок как в шаблоне
-- Форматирование ссылки как в шаблоне
local function getLink( link, text, comment, hasComment )
local function getLink( link, text, comment, hasCustomComment )
if isEmpty( link ) then
if isEmpty( link ) then
return text
return text
if not isEmpty( comment ) then
if not isEmpty( comment ) then
local html = mw.html.create( 'span' )
:attr( 'title', comment )
:wikitext( text )
if hasCustomComment then
html:attr( 'style', 'border-bottom:1px dotted;' )
end
end
text = tostring( html )
end
end
-- Поддержка параметра {{{comment|}}}
-- Поддержка параметра {{{comment|}}}
local comment = args.comment or args[ 'comment-default' ] or args.link
local comment = getComment( args.comment or args[ 'comment-default' ], args.link, date )
tag
tag