Module:Documentation: Difference between revisions

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
(fix subjectSpace var in makeSubpagesBlurb)
(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)
Line 174:
-- 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.compareLinkcompareUrl - 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
Line 280:
end
function envFuncs.compareLinkcompareUrl()
-- Diff link between the sandbox and the main template using [[Special:ComparePages]].
local templateTitle = env.templateTitle
Line 288:
{page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
)
compareUrl =return tostring(compareUrl)
local compareDisplay = message('compareLinkDisplay', 'string')
return makeUrlLink(compareUrl, compareDisplay)
end
 
Line 316 ⟶ 314:
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).'
textlocal comparedisplay = text .. message('sandboxNoticeDiffBlurbsandboxnoticecomparelinkdisplay', 'string', {templateLink, env.compareLink})
local comparelink = makeurllink(compareurl, comparedisplay)
text = text .. message('sandboxNoticeDiffBlurb', 'string', {templateLink, compareLink})
end
-- Get the test cases page blurb if the page exists.
Line 710 ⟶ 711:
local sandboxEditDisplay = message('sandboxEditLinkDisplay', 'string')
local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay)
local compareLinkcompareUrl = env.compareLinkcompareUrl
local compareLink
if compareUrl then
local compareDisplay = message('compareLinkDisplay', 'string')
return compareLink = makeUrlLink(compareUrl, compareDisplay)
end
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
else
Anonymous user