Editing Module:Documentation
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 136: | Line 136: | ||
:attr('id', message('main-div-id')) | :attr('id', message('main-div-id')) | ||
:addClass(message('main-div-classes')) | :addClass(message('main-div-classes')) | ||
− | |||
:newline() | :newline() | ||
:wikitext(p._startBox(args, env)) | :wikitext(p._startBox(args, env)) | ||
Line 356: | Line 355: | ||
-- "This is the template sandbox for [[Template:Foo]] (diff)." | -- "This is the template sandbox for [[Template:Foo]] (diff)." | ||
local text = '' | local text = '' | ||
− | |||
− | |||
local pagetype | local pagetype | ||
if subjectSpace == 10 then | if subjectSpace == 10 then | ||
Line 368: | Line 365: | ||
local templateLink = makeWikilink(templateTitle.prefixedText) | local templateLink = makeWikilink(templateTitle.prefixedText) | ||
local compareUrl = env.compareUrl | local compareUrl = env.compareUrl | ||
− | if | + | if compareUrl then |
− | |||
− | |||
local compareDisplay = message('sandbox-notice-compare-link-display') | local compareDisplay = message('sandbox-notice-compare-link-display') | ||
local compareLink = makeUrlLink(compareUrl, compareDisplay) | local compareLink = makeUrlLink(compareUrl, compareDisplay) | ||
text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) | text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) | ||
+ | else | ||
+ | text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) | ||
end | end | ||
-- Get the test cases page blurb if the page exists. This is something like | -- Get the test cases page blurb if the page exists. This is something like | ||
Line 405: | Line 402: | ||
-- '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 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
protectionLevels = env.protectionLevels | protectionLevels = env.protectionLevels | ||
if not protectionLevels then | if not protectionLevels then | ||
return nil | return nil | ||
end | end | ||
− | local | + | local editProt = protectionLevels.edit and protectionLevels.edit[1] |
− | local | + | local moveProt = protectionLevels.move and protectionLevels.move[1] |
− | + | if editProt then | |
− | -- The page is | + | -- The page is edit-protected. |
− | + | mProtectionBanner = require('Module:Protection banner') | |
− | return | + | 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 552: | Line 550: | ||
-- | -- | ||
-- Messages: | -- Messages: | ||
− | -- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt= | + | -- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]' |
-- 'template-namespace-heading' --> 'Template documentation' | -- 'template-namespace-heading' --> 'Template documentation' | ||
-- 'module-namespace-heading' --> 'Module documentation' | -- 'module-namespace-heading' --> 'Module documentation' | ||
Line 857: | Line 855: | ||
local mirrorPreload = message('mirror-link-preload') | local mirrorPreload = message('mirror-link-preload') | ||
local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} | local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} | ||
+ | if subjectSpace == 828 then | ||
+ | mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary} | ||
+ | end | ||
local mirrorDisplay = message('mirror-link-display') | local mirrorDisplay = message('mirror-link-display') | ||
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) | local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) | ||
Line 868: | Line 869: | ||
local testcasesEditDisplay = message('testcases-edit-link-display') | local testcasesEditDisplay = message('testcases-edit-link-display') | ||
local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay) | local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay) | ||
− | testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) | + | -- for Modules, add testcases run link if exists |
+ | if subjectSpace == 828 and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then | ||
+ | local testcasesRunLinkDisplay = message('testcases-run-link-display') | ||
+ | local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) | ||
+ | testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink) | ||
+ | else | ||
+ | testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) | ||
+ | end | ||
else | else | ||
local testcasesPreload | local testcasesPreload |