モジュール:サンドボックス/ロングラン/test
表示
local p = {}
local expiry = require("モジュール:Effective protection expiry")
function p.main(frame)
local pageName = frame.args[1]
local page = mw.title.new( pageName )
mw.log(mw.dumpObject(page.protectionLevels))
local returnProtectionLevels = ""
for action, level in pairs( page.protectionLevels ) do
if level[1] ~= nil then
local actionMsg = mw.message.new( "restriction-"..action):plain()
if action == "create" then
if level[1] == "editprotected" then
level[1] = "sysop"
elseif level[1] == "editsemiprotected" then
level[1] = "autoconfirmed"
end
end
local levelMsg = mw.message.new( "protect-level-"..level[1] ):plain()
local expiry = expiry._main(action, pageName)
local expiryMsg
if expiry == "infinity" then
expiryMsg = mw.message.new("protect-expiry-indefinite"):plain()
else
expiryMsg = mw.message.new("protect-expiring", expiry):plain()
end
returnProtectionLevels = mw.message.new( "protect-summary-desc", actionMsg, levelMsg, expiryMsg ):plain().." "..returnProtectionLevels
mw.log(mw.dumpObject( returnProtectionLevels ))
end
end
returnProtectionLevels = returnProtectionLevels ~= "" and returnProtectionLevels or "未保護"
return returnProtectionLevels
end
return p