Difference between revisions 51812 and 51813 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')

-- Get the config table.
(contracted; show full)		-- Title object for the /testcases subpage.
		return mw.title.new(env.docpageRoot .. '/' .. message('testcasesSubpage', 'string'))
	end
	
	function envFuncs.printTitle()
		-- Title object for the /Print subpage.
		return mw.title.new(env.templatePage .. '/' .. message('printSubpage', 'string'))
	end

	
	function envFuncs.compareLink()
		-- Diff link between the sandbox and the main template using [[Special:ComparePages]].
		local templateTitle = env.templateTitle
		local sandboxTitle = env.sandboxTitle
		local compareUrl = mw.uri.fullUrl(
			'Special:ComparePages',
			{page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
		)
		compareUrl = tostring(compareUrl)
		local compareDisplay = message('compareLinkDisplay', 'string')
		return makeUrlLink(compareUrl, compareDisplay)
	end		

	return env
end	

----------------------------------------------------------------------------
-- Auxiliary templates
----------------------------------------------------------------------------
(contracted; show full)
	if sandboxTitle.exists then
		local sandboxPage = sandboxTitle.prefixedText
		local sandboxDisplay = message('sandboxLinkDisplay', 'string')
		local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)
		local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'}
		local sandboxEditDisplay = message('sandboxEditLinkDisplay', 'string')
		local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay)
		local compare
Url = mw.uri.fullUrl('Special:ComparePages', {page1 = templateTitle.prefixedText, page2 = sandboxPage})
		compareUrl = tostring(compareUrl)
		local compareDisplay = message('compareLinkDisplay', 'string')
		local compareLink = makeUrlLink(compareUrl, compareDisplay)Link = env.compareLink
		sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
	else
		local sandboxPreload
		if subjectSpace == 828 then
			sandboxPreload = message('moduleSandboxPreload', 'string')
		else
			sandboxPreload = message('templateSandboxPreload', 'string')
(contracted; show full)
		local sort = (title.namespace == 0 and message('strangeUsageCategoryMainspaceSort', 'string') or '') .. title.prefixedText -- Sort on namespace.
		ret = ret .. makeCategoryLink(message('strangeUsageCategory', 'string'), sort)
	end
	return ret
end

return p