Module:Sandbox/Jackmcbarn/PolymorphicEditProtected
Appearance
Uses Template:PolymorphicEditProtected
Example:
{{safesubst:PolymorphicEditProtected|o|Main Page|close=no}}
Lua error in Module:Effective_protection_level at line 90: attempt to index field 'args' (a nil value).
local effectiveProtectionLevel = require('Module:Effective protection level').main
local p = {}
p.c = function(frame)
if mw.isSubsting() then
if frame:getParent().args['reopen'] == 'no' then
return '{{safesubst:PolymorphicEditProtected|c|' .. frame:getParent().args[2] .. '|' .. frame:getParent().args[3] .. '|reopen=no}}'
else
return '{{safesubst:PolymorphicEditProtected|o|' .. frame:getParent().args[2] .. '|close=no}}'
end
else
-- if reopen is set, we'll never get here unless we weren't safesubst'd correctly
return 'This is an answered edit request. When it was closed, the page was protected with level ' .. frame:getParent().args[2]
end
end
p.o = function(frame)
if mw.isSubsting() then
if frame:getParent().args['close'] == 'no' then
return '{{safesubst:PolymorphicEditProtected|o|' .. frame:getParent().args[2] .. '|close=no}}'
else
return '{{safesubst:PolymorphicEditProtected|c|' .. frame:getParent().args[2] .. '|' .. (effectiveProtectionLevel('edit', frame:getParent().args[2]) or '') .. '|reopen=no}}'
end
else
-- if close is set, we'll never get here unless we weren't safesubst'd correctly
return 'This is an unanswered edit request. Currently, the page is protected with level ' .. (effectiveProtectionLevel('edit', frame:getParent().args[2]) or '')
end
end
return p