Module:Documentation: Difference between revisions
Content deleted Content added
don't use mw.uri.encode - title:fullUrl already encodes the strings for us |
use a makeToolbar function instead of writing out the toolbars by hand |
||
Line 27:
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
----------------------------------------------------------------------------
Line 271 ⟶ 283:
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 .. '. '
..
elseif subjectSpace == 828 then
-- /doc does not exist; ask to create it.
Line 288 ⟶ 300:
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 .. '
else
local sandboxPreload = 'Template:Documentation/preload-' .. (subjectSpace == 828 and 'module-' or '') .. 'sandbox'
Line 294 ⟶ 306:
local mirrorSummary = 'Create sandbox version of ' .. makeWikilink(templatePage)
local mirrorLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit', preload = templatePage, summary = mirrorSummary}, 'mirror')
text = text .. 'sandbox
end
text = text .. ' and '
Line 301 ⟶ 313:
local testcasesLink = makeWikilink(testcases, 'testcases')
local testcasesEditLink = makeUrlLink(testcaseTitle:fullUrl{action = 'edit'}, 'edit')
text = text .. testcasesLink .. '
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
end
text = text .. ' pages. <br />'
|