×
新規記事を作成
ここにページのタイトルを記入:
We currently have 2 articles on 政治ボールwiki 日本語版. Type your article name above or click on one of the titles below and start writing!



    政治ボールwiki 日本語版

    モジュール:Effective protection expiry

    2026年7月4日 (土) 15:47時点におけるLiberalPolandball (トーク | 投稿記録)による版 (ページの作成:「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 ==…」)
    (差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)

    このモジュールについての説明文ページを モジュール:Effective protection expiry/doc に作成できます

    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