Difference between revisions 51758 and 51759 on wikimaniawiki

-- This module implements {{documentation}}.

-- Get required modules.
local getArgs = require('Module:Arguments').getArgs
local htmlBuilder = require('Module:HtmlBuilder')
local messageBox = require('Module:Message box')

local p = {}
(contracted; show full)
			local purgeLink = makeUrlLink(docTitle:fullUrl{action = 'purge'}, 'purge')
			local text = '[%s] [%s] [%s] [%s]'
			text = text:gsub('%[', '[') -- Replace square brackets with HTML entities.
			text = text:gsub('%]', ']')
			lspan.wikitext(mw.ustring.format(text, viewLink, editLink, historyLink, purgeLink))
		else
			if 
not preload then
				preload = mw.uri.encode(preload)
			elseif subjectSpace == 6 then -- File namespace
						preload = 'Template:Documentation/preload-filespace'
					else
						preload = 'Template:Documentation/preload'
				end
			end
			lspan.wikitext(makeUrlLink(docTitle:fullUrl{action = 'edit', preload = preload}, 'create'))
		end
	end

	return tostring(sbox)
end

(contracted; show full)
			text = text .. 'Editors can experiment in this ' .. pagePossessive .. ' '
			local sandboxTitle = mw.title.new(sandbox)
			if sandboxTitle.exists then
				local sandboxLink = makeWikilink(sandbox, 'sandbox')
				local sandboxEditLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit'}, 'edit')
				local compareLink = makeUrlLink(mw.title.new('Special:ComparePages'):fullUrl{page1 = 
mw.uri.encode(templatePage), page2 = mw.uri.encode(sandbox)}, 'diff')
				text = text .. sandboxLink .. ' <small style="font-style: normal">(' .. sandboxEditLink .. ' | ' .. compareLink .. ')</small>'
			else
				local sandboxPreload = 'Template:Documentation/preload-' .. (subjectSpace == 828 and 'module-' or '') .. 'sandbox'
				local sandboxCreateLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload}, 'create')
				local mirrorPreload = mw.uri.encode(templatePage)
				local mirrorSummary = mw.uri.encode(Summary = 'Create sandbox version of ' .. makeWikilink(templatePage))
				local mirrorLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreloadtemplatePage, summary = mirrorSummary}, 'mirror')
				text = text .. 'sandbox <small style="font-style: normal">(' .. sandboxCreateLink .. ' | ' .. mirrorLink .. ')</small>'
			end
			text = text .. ' and '
			local testcaseTitle = mw.title.new(testcases)
			if testcaseTitle.exists then
				local testcasesLink = makeWikilink(testcases, 'testcases')
(contracted; show full)	if subpage == 'sandbox' or subpage == 'testcases' then
		return currentTitle.baseText
	else
		return currentTitle.text
	end
end

return p