Module:Documentation: Difference between revisions

Jump to navigation Jump to search
revert
m (1 revision)
 
(revert)
 
(12 intermediate revisions by the same user not shown)
Line 146: Line 146:
.done()
.done()
.wikitext(p._endBox(args, env))
.wikitext(p._endBox(args, env))
.newline()
.wikitext(p.addTrackingCategories(env))
.wikitext(p.addTrackingCategories(env))
return tostring(root)
return tostring(root)
Line 333: Line 332:
--  
--  
-- Messages:
-- Messages:
-- 'sandbox-notice-image' --> '[[Image:Sandbox.png|50px|alt=|link=]]'
-- 'sandbox-notice-image' --> '[[Image:Sandbox.svg|50px|alt=|link=]]'
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
Line 406: Line 405:
-- 'protection-template' --> 'pp-template'
-- 'protection-template' --> 'pp-template'
-- 'protection-template-args' --> {docusage = 'yes'}
-- 'protection-template-args' --> {docusage = 'yes'}
local protectionLevels, mProtectionBanner
local title = env.title
local title = env.title
local protectionLevels
if title.namespace ~= 10 and title.namespace ~= 828 then
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.
-- Don't display the protection template if we are not in the template or module namespaces.
return nil
return nil
Line 418: Line 415:
return nil
return nil
end
end
local editLevels = protectionLevels.edit
local editProt = protectionLevels.edit and protectionLevels.edit[1]
local moveLevels = protectionLevels.move
local moveProt = protectionLevels.move and protectionLevels.move[1]
if moveLevels and moveLevels[1] == 'sysop' or editLevels and editLevels[1] then
if editProt then
-- The page is full-move protected, or full, template, or semi-protected.
-- The page is edit-protected.
local frame = mw.getCurrentFrame()
mProtectionBanner = require('Module:Protection banner')
return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')}
local reason = message('protection-reason-edit')
return mProtectionBanner._main{reason, small = true}
elseif moveProt and moveProt ~= 'autoconfirmed' then
-- The page is move-protected but not edit-protected. Exclude move
-- protection with the level "autoconfirmed", as this is equivalent to
-- no move protection at all.
mProtectionBanner = require('Module:Protection banner')
return mProtectionBanner._main{action = 'move', small = true}
else
else
return nil
return nil
Line 553: Line 557:
--
--
-- Messages:
-- Messages:
-- 'documentation-icon-wikitext' --> '[[File:Template-info.png|50px|link=|alt=Documentation icon]]'
-- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=Documentation icon]]'
-- 'template-namespace-heading' --> 'Template documentation'
-- 'template-namespace-heading' --> 'Template documentation'
-- 'module-namespace-heading' --> 'Module documentation'
-- 'module-namespace-heading' --> 'Module documentation'
Line 646: Line 650:
env = env or p.getEnvironment(args)
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
local docTitle = env.docTitle
local content = args.content or args._content
local content = args.content
if not content and docTitle and docTitle.exists then
if not content and docTitle and docTitle.exists then
local frame = mw.getCurrentFrame()
content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}
content = frame:expandTemplate{title = docTitle.prefixedText}
end
end
-- The line breaks below are necessary so that "=== Headings ===" at the start and end
-- The line breaks below are necessary so that "=== Headings ===" at the start and end
Line 728: Line 731:
-- Add sandbox and testcases links.
-- Add sandbox and testcases links.
-- "Editors can experiment in this template's sandbox and testcases pages."
-- "Editors can experiment in this template's sandbox and testcases pages."
text = text .. p.makeExperimentBlurb(args, env)
text = text .. (p.makeExperimentBlurb(args, env) or '')
text = text .. '<br />'
text = text .. '<br />'
if not args.content and not args[1] then
if not args.content and not args[1] then
14,061

edits

Navigation menu