Module:Documentation: Difference between revisions

Jump to navigation Jump to search
revert
(Reverted to revision 20029 by Bgwhite (talk): Restore. (TW))
(revert)
 
(17 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 380: Line 379:
local testcasesTitle = env.testcasesTitle
local testcasesTitle = env.testcasesTitle
if testcasesTitle and testcasesTitle.exists then
if testcasesTitle and testcasesTitle.exists then
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
if testcasesTitle.namespace == mw.site.namespaces.Module.id then
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink})
else
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
end
end
end
-- Add the sandbox to the sandbox category.
-- Add the sandbox to the sandbox category.
Line 398: 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
end
end
protectionLevels = env.protectionLevels
protectionLevels = env.protectionLevels
local editLevels = protectionLevels.edit
if not protectionLevels then
local moveLevels = protectionLevels.move
return nil
if moveLevels and moveLevels[1] == 'sysop' or editLevels and editLevels[1] then
end
-- The page is full-move protected, or full, template, or semi-protected.
local editProt = protectionLevels.edit and protectionLevels.edit[1]
local frame = mw.getCurrentFrame()
local moveProt = protectionLevels.move and protectionLevels.move[1]
return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')}
if editProt then
-- The page is edit-protected.
mProtectionBanner = require('Module:Protection banner')
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 542: 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 637: Line 652:
local content = 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
-- of docs are interpreted correctly.
-- of docs are interpreted correctly.
return '\n' .. (content or '') .. '\n'  
return '\n' .. (content or '') .. '\n'  
end
p.contentTitle = makeInvokeFunc('_contentTitle')
function p._contentTitle(args, env)
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
if not args.content and docTitle and docTitle.exists then
return docTitle.prefixedText
else
return ''
end
end
end


Line 705: 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