Изменения
Перейти к навигации
Перейти к поиску
Строка 3:
Строка 3:
+
Строка 121:
Строка 122:
+
− +
+
+
+
+
+
+
+
+
+
+
+
+
Строка 131:
Строка 145:
− local getArgs = require( 'Module:Arguments' ).getArgs
Модуль:Надстрочное предупреждение (посмотреть исходный код)
Версия от 04:35, 16 мая 2023
, 2 года назадтест
local mwLang = mw.getContentLanguage()
local mwLang = mw.getContentLanguage()
local getArgs = require( 'Module:Arguments' ).getArgs
local function isEmpty( val )
local function isEmpty( val )
-- Поддержка подстановки без Unsubst
-- Поддержка подстановки без Unsubst
function p.subst( frame )
function p.subst( frame )
local args = getArgs( frame )
local mTemplateInvocation = require( 'Module:Template invocation' )
local mTemplateInvocation = require( 'Module:Template invocation' )
local name = mTemplateInvocation.name( frame:getParent():getTitle() )
local name = mTemplateInvocation.name( frame:getParent():getTitle() )
return mTemplateInvocation.invocation( name )
local timestamp = mwLang:formatDate( 'd-m-Y' )
local date = mw.text.split( timestamp, '-' )
if isEmpty( args[ '2' ] ) then
args[ '2' ] = date[ 1 ]
end
if isEmpty( args[ '3' ] ) then
args[ '3' ] = date[ 2 ]
end
if isEmpty( args[ '4' ] ) then
args[ '4' ] = date[ 3 ]
end
return mTemplateInvocation.invocation( name, args )
end
end
--
--
function p.main( frame )
function p.main( frame )
local args = getArgs( frame )
local args = getArgs( frame )
local date = getValidDate( args.year, args.month, args.day )
local date = getValidDate( args.year, args.month, args.day )