Module:Documentation: Difference between revisions
Content added Content deleted
m (1 revision imported: Math) |
(remove REVISIONID - see Special:PermaLink/725652098#Preview-only template warnings using REVISIONID magic word) |
||
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 367: | 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}) |
||
⚫ | |||
⚫ | |||
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 406: | Line 404: | ||
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 |
|||
⚫ | |||
protectionLevels = env.protectionLevels |
protectionLevels = env.protectionLevels |
||
if not protectionLevels then |
if not protectionLevels then |
||
Line 861: | 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} |
|||
⚫ | |||
local mirrorDisplay = message('mirror-link-display') |
local mirrorDisplay = message('mirror-link-display') |
||
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) |
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) |
||
Line 872: | 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) |
||
-- 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 |
|||
⚫ | |||
end |
|||
else |
else |
||
local testcasesPreload |
local testcasesPreload |