モジュール:Effective protection expiry
ページに
使 い方
このモジュールは
ほかのモジュールからの利用
local effectiveProtectionExpiry = require('モジュール:Effective protection expiry')._main
この
このYY-MM-DDThh:mm:ss
)の
infinity
-無 期限 保護 の場合 か、保護 されていないページ(ページが存在 する場合 )unknown
-有効 期限 が不明 な場合 、保護 されていないページ(ページが存在 しない場合 )
ページがinfinity
を
ウィキテキストからの利用
{{#invoke:Effective protection expiry|
操作 |ページ名 }}
関連 項目
local p = {}
-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title)
return stabilitySettings and stabilitySettings.expiry or 'unknown'
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then
error( '第 1引数 にはedit、move、create、upload、autoreviewのどれかを指定 してください', 2 )
end
local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename)
if rawExpiry == 'infinity' then
return 'infinity'
elseif rawExpiry == '' then
return 'unknown'
else
local year, month, day, hour, minute, second = rawExpiry:match(
'^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$'
)
if year then
return string.format(
'%s-%s-%sT%s:%s:%s',
year, month, day, hour, minute, second
)
else
error('[[モジュール:Effective protection expiry]]のエラー; 有効 期限 のタイムスタンプの書式 が不正 です')
end
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p