Changes
Jump to navigation
Jump to search
Line 532:
Line 532:
−
− local function escapeBrackets(s)
− -- Escapes square brackets with HTML entities.
− s = s:gsub('%[', '[') -- Replace square brackets with HTML entities.
− s = s:gsub('%]', ']')
− return s
− end
− local ret
− local title = data.title+
− +
− +
− +
− ret = '[%s] [%s] [%s] [%s]' +
− ret = escapeBrackets(ret)
− ret = mw.ustring.format(ret, viewLink, editLink, historyLink, purgeLink)
− ret = '[%s] [%s]' +
− ret = escapeBrackets(ret)
− ret = mw.ustring.format(ret, createLink, purgeLink)
Line 771:
Line 759:
− local editUrl = docTitle:fullUrl{action = 'edit'}
− +
− local historyUrl = docTitle:fullUrl{action = 'history'}
− +
Line 834:
Line 820:
− local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'}
− +
Line 870:
Line 855:
− +
per tper
-- @data - a table of data generated by p.makeStartBoxLinksData
-- @data - a table of data generated by p.makeStartBoxLinksData
--]]
--]]
local docTitle = data.docTitle
local docTitle = data.docTitle
local purgeLink = makeWikilink("Special:Purge/" .. docTitle.prefixedText, data.purgeLinkDisplay)
local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay)
if docTitle.exists then
if docTitle.exists then
local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)
local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)
local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, data.editLinkDisplay)
local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, data.editLinkDisplay)
local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, data.historyLinkDisplay)
local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, data.historyLinkDisplay)
return "[" .. viewLink .. "] [" .. editLink .. "] [" .. historyLink .. "] [" .. purgeLink .. "]"
else
else
local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)
local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)
return "[" .. createLink .. "] [" .. purgeLink .. "]"
end
end
return ret
return ret
-- /doc exists; link to it.
-- /doc exists; link to it.
local docLink = makeWikilink(docTitle.prefixedText)
local docLink = makeWikilink(docTitle.prefixedText)
local editDisplay = message('edit-link-display')
local editDisplay = message('edit-link-display')
local editLink = makeUrlLink(editUrl, editDisplay)
local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, editDisplay)
local historyDisplay = message('history-link-display')
local historyDisplay = message('history-link-display')
local historyLink = makeUrlLink(historyUrl, historyDisplay)
local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, historyDisplay)
ret = message('transcluded-from-blurb', {docLink})
ret = message('transcluded-from-blurb', {docLink})
.. ' '
.. ' '
local sandboxDisplay = message('sandbox-link-display')
local sandboxDisplay = message('sandbox-link-display')
local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)
local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)
local sandboxEditDisplay = message('sandbox-edit-link-display')
local sandboxEditDisplay = message('sandbox-edit-link-display')
local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay)
local sandboxEditLink = makeWikilink("Special:EditPage/" .. sandboxPage, sandboxEditDisplay)
local compareUrl = env.compareUrl
local compareUrl = env.compareUrl
local compareLink
local compareLink
local testcasesEditUrl = testcasesTitle:fullUrl{action = 'edit'}
local testcasesEditUrl = testcasesTitle:fullUrl{action = 'edit'}
local testcasesEditDisplay = message('testcases-edit-link-display')
local testcasesEditDisplay = message('testcases-edit-link-display')
local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay)
local testcasesEditLink = makeWikilink("Special:EditPage/" .. testcasesPage, testcasesEditDisplay)
-- for Modules, add testcases run link if exists
-- for Modules, add testcases run link if exists
if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then
if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then