Editing Documentation
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 355: | 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 frame = mw.getCurrentFrame() | ||
+ | local isPreviewing = frame:preprocess('{{REVISIONID}}') == '' -- True if the page is being previewed. | ||
local pagetype | local pagetype | ||
if subjectSpace == 10 then | if subjectSpace == 10 then | ||
Line 365: | Line 367: | ||
local templateLink = makeWikilink(templateTitle.prefixedText) | local templateLink = makeWikilink(templateTitle.prefixedText) | ||
local compareUrl = env.compareUrl | local compareUrl = env.compareUrl | ||
− | if compareUrl then | + | if isPreviewing or not compareUrl then |
+ | text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) | ||
+ | else | ||
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}) | ||
− | |||
− | |||
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 404: | Line 406: | ||
local protectionLevels, mProtectionBanner | local protectionLevels, mProtectionBanner | ||
local title = env.title | local title = env.title | ||
+ | if title.namespace ~= 10 and title.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 | protectionLevels = env.protectionLevels | ||
if not protectionLevels then | if not protectionLevels then | ||
Line 550: | Line 556: | ||
-- | -- | ||
-- 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=Documentation icon]]' |
-- 'template-namespace-heading' --> 'Template documentation' | -- 'template-namespace-heading' --> 'Template documentation' | ||
-- 'module-namespace-heading' --> 'Module documentation' | -- 'module-namespace-heading' --> 'Module documentation' | ||
Line 855: | Line 861: | ||
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} | ||
− | |||
− | |||
− | |||
local mirrorDisplay = message('mirror-link-display') | local mirrorDisplay = message('mirror-link-display') | ||
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) | local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) | ||
Line 869: | Line 872: | ||
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) | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
else | else | ||
local testcasesPreload | local testcasesPreload |