| Latest revision |
Your text |
| Line 138: |
Line 138: |
| root | | root |
| :wikitext(p._getModuleWikitext(args, env)) | | :wikitext(p._getModuleWikitext(args, env)) |
| :wikitext(p.protectionTemplate(env))
| |
| :wikitext(p.sandboxNotice(args, env)) | | :wikitext(p.sandboxNotice(args, env)) |
| -- This div tag is from {{documentation/start box}}, but moving it here | | -- This div tag is from {{documentation/start box}}, but moving it here |
| Line 414: |
Line 413: |
| end | | end |
|
| |
|
| function p.protectionTemplate(env)
| |
| -- Generates the padlock icon in the top right.
| |
| -- @env - environment table containing title objects, etc., generated with p.getEnvironment
| |
| -- Messages:
| |
| -- 'protection-template' --> 'pp-template'
| |
| -- 'protection-template-args' --> {docusage = 'yes'}
| |
| local title = env.title
| |
| local protectionLevels
| |
| local protectionTemplate = message('protection-template')
| |
| local namespace = title.namespace
| |
| if not (protectionTemplate and (namespace == 10 or namespace == 828)) then
| |
| -- Don't display the protection template if we are not in the template or module namespaces.
| |
| return nil
| |
| end
| |
| protectionLevels = env.protectionLevels
| |
| if not protectionLevels then
| |
| return nil
| |
| end
| |
| local editLevels = protectionLevels.edit
| |
| local moveLevels = protectionLevels.move
| |
| if moveLevels and moveLevels[1] == 'sysop' or editLevels and editLevels[1] then
| |
| -- The page is full-move protected, or full, template, or semi-protected.
| |
| local frame = mw.getCurrentFrame()
| |
| return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')}
| |
| else
| |
| return nil
| |
| end
| |
| end
| |
|
| |
|
| ---------------------------------------------------------------------------- | | ---------------------------------------------------------------------------- |