Changes
only generate the URL for the compare link in the env table - the rest is now done elsewhere so that the display can be different in different places
-- env.docSpace - the number of the namespace the title puts its documentation in.
-- env.docpageRoot - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace.
-- env.compareLink compareUrl - a URL link of the Special:ComparePages page comparing the sandbox with the template.
--
-- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value
end
function envFuncs.compareLinkcompareUrl()
-- Diff link between the sandbox and the main template using [[Special:ComparePages]].
local templateTitle = env.templateTitle
{page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
)
end
local isPreviewing = frame:preprocess('{{REVISIONID}}') == '' -- True if the page is being previewed.
local templateLink = makeWikilink(templateTitle.prefixedText)
local compareUrl = env.compareUrl if isPreviewing or not compareUrl then
-- 'This is the [[Wikipedia:Template test cases|template sandbox]] page for $1.'
text = text .. message('sandboxNoticeBlurb', 'string', {templateLink})
else
-- 'This is the [[Wikipedia:Template test cases|template sandbox]] page for $1 ($2).'
local comparedisplay = message('sandboxnoticecomparelinkdisplay', 'string') local comparelink = makeurllink(compareurl, comparedisplay) text = text .. message('sandboxNoticeDiffBlurb', 'string', {templateLink, env.compareLink})
end
-- Get the test cases page blurb if the page exists.
local sandboxEditDisplay = message('sandboxEditLinkDisplay', 'string')
local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay)
local compareLink compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compareLinkDisplay', 'string') compareLink= makeUrlLink(compareUrl, compareDisplay) end
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
else