Changes
use a makeToolbar function instead of writing out the toolbars by hand
return mw.ustring.format('[%s %s]', url, display)
end
local function makeToolbar(...)
local ret = {}
local lim = select('#', ...)
if lim < 1 then
return nil
end
for i = 1, lim do
ret[#ret + 1] = select(i, ...)
end
return '<small style="font-style: normal;">(' .. table.concat(ret, ' | ') .. ')</small>'
end
----------------------------------------------------------------------------
local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, 'edit')
local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, 'history')
text = text .. 'The above [[Wikipedia:Template documentation|documentation]] is [[Wikipedia:Transclusion|transcluded]] from ' .. docLink .. '.' .. ' <small style="font-style: normal;">makeToolbar(' .. editLink .. ' | ' .. , historyLink ) .. ')</small> <br />'
elseif subjectSpace == 828 then
-- /doc does not exist; ask to create it.
local sandboxEditLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit'}, 'edit')
local compareLink = makeUrlLink(mw.title.new('Special:ComparePages'):fullUrl{page1 = templatePage, page2 = sandbox}, 'diff')
text = text .. sandboxLink .. ' <small style="font-style: normal">(' .. makeToolbar(sandboxEditLink .. ' | ' .. , compareLink .. ')</small>'
else
local sandboxPreload = 'Template:Documentation/preload-' .. (subjectSpace == 828 and 'module-' or '') .. 'sandbox'
local mirrorSummary = 'Create sandbox version of ' .. makeWikilink(templatePage)
local mirrorLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit', preload = templatePage, summary = mirrorSummary}, 'mirror')
text = text .. 'sandbox <small style="font-style: normal">(' .. makeToolbar(sandboxCreateLink .. ' | ' .. , mirrorLink .. ')</small>'
end
text = text .. ' and '
local testcasesLink = makeWikilink(testcases, 'testcases')
local testcasesEditLink = makeUrlLink(testcaseTitle:fullUrl{action = 'edit'}, 'edit')
text = text .. testcasesLink .. ' <small style="font-style: normal">(' .. makeToolbar(testcasesEditLink .. ')</small>'
else
local testcasesPreload = 'Template:Documentation/preload-' .. (subjectSpace == 828 and 'module-' or '') .. 'testcases'
local testcasesCreateLink = makeUrlLink(testcaseTitle:fullUrl{action = 'edit', preload = testcasesPreload}, 'create')
text = text .. 'testcases <small style="font-style: normal">(' .. makeToolbar(testcasesCreateLink .. ')</small>'
end
text = text .. ' pages. <br />'