Module:Documentation: Difference between revisions
don't use mw.uri.encode - title:fullUrl already encodes the strings for us
m>Mr. Stradivarius (replace content with a port of English Wikipedia's Template:Documentation) |
m>Mr. Stradivarius (don't use mw.uri.encode - title:fullUrl already encodes the strings for us) |
||
Line 187: | Line 187: | ||
lspan.wikitext(mw.ustring.format(text, viewLink, editLink, historyLink, purgeLink)) | lspan.wikitext(mw.ustring.format(text, viewLink, editLink, historyLink, purgeLink)) | ||
else | else | ||
if preload then | if not preload then | ||
if subjectSpace == 6 then -- File namespace | |||
preload = 'Template:Documentation/preload-filespace' | |||
else | |||
preload = 'Template:Documentation/preload' | |||
end | |||
end | end | ||
lspan.wikitext(makeUrlLink(docTitle:fullUrl{action = 'edit', preload = preload}, 'create')) | lspan.wikitext(makeUrlLink(docTitle:fullUrl{action = 'edit', preload = preload}, 'create')) | ||
Line 287: | Line 287: | ||
local sandboxLink = makeWikilink(sandbox, 'sandbox') | local sandboxLink = makeWikilink(sandbox, 'sandbox') | ||
local sandboxEditLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit'}, 'edit') | local sandboxEditLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit'}, 'edit') | ||
local compareLink = makeUrlLink(mw.title.new('Special:ComparePages'):fullUrl{page1 = | local compareLink = makeUrlLink(mw.title.new('Special:ComparePages'):fullUrl{page1 = templatePage, page2 = sandbox}, 'diff') | ||
text = text .. sandboxLink .. ' <small style="font-style: normal">(' .. sandboxEditLink .. ' | ' .. compareLink .. ')</small>' | text = text .. sandboxLink .. ' <small style="font-style: normal">(' .. sandboxEditLink .. ' | ' .. compareLink .. ')</small>' | ||
else | else | ||
local sandboxPreload = 'Template:Documentation/preload-' .. (subjectSpace == 828 and 'module-' or '') .. 'sandbox' | local sandboxPreload = 'Template:Documentation/preload-' .. (subjectSpace == 828 and 'module-' or '') .. 'sandbox' | ||
local sandboxCreateLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload}, 'create') | local sandboxCreateLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload}, 'create') | ||
local mirrorSummary = 'Create sandbox version of ' .. makeWikilink(templatePage) | |||
local mirrorSummary = | local mirrorLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit', preload = templatePage, summary = mirrorSummary}, 'mirror') | ||
local mirrorLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit', preload = | |||
text = text .. 'sandbox <small style="font-style: normal">(' .. sandboxCreateLink .. ' | ' .. mirrorLink .. ')</small>' | text = text .. 'sandbox <small style="font-style: normal">(' .. sandboxCreateLink .. ' | ' .. mirrorLink .. ')</small>' | ||
end | end |