Difference between revisions 51765 and 51766 on wikimaniawiki

-- This module implements {{documentation}}.

----------------------------------------------------------------------------
-- Configuration
----------------------------------------------------------------------------

-- Here you can set the values of the parameters and messages used in this module, so that it
-- can be easily ported to other wikis.
(contracted; show full)
-- The following are software settings that may change from wiki to wiki. For example, the classes
-- defined in commons.css or the names of templates.

cfg.mainDivId = 'template-documentation' -- The "id" attribute of the main HTML "div" tag.
cfg.mainDivClasses = 'template-documentation iezoomfix' -- The CSS classes added to the main HTML "div" tag.
cfg.sandboxSubpage = 'sandbox' -- The name of the template subpage typically used for sandboxes.

cfg.sandboxNoticeTemplate = 'template sandbox notice' -- The name of the template to display at the top of sandbox pages.
cfg.sandboxNoticeLivepageParam = 1 -- The parameter of the sandbox notice template to send the cfg.livepageArg to.

-- Display settings
-- The following settings configure the values displayed by the module.

cfg.sandboxLinkDisplay = 'sandbox'

----------------------------------------------------------------------------
(contracted; show full)			.done()
		.wikitext(p._endBox(args))
		.wikitext(p.addTrackingCategories())
	return tostring(root)
end

function p.sandboxNotice(args)
	
iflocal sandboxNoticeTemplate = cfg.sandboxNoticeTemplate
	if not (sandboxNoticeTemplate and currentTitle.subpageText == cfg.sandboxSubpage) then
		return nil
	end
	local frame = mw.getCurrentFrame()
			local rootnotice = htmlBuilder.create()
		root
	notice
		.tag('div')
					.css('clear', 'both')
					.done()
				.wikitext(frame:expandTemplate{title = 'template sandboxNoticeTemplate, args = {[cfg.sandbox nNotice', argsLivepageParam] = {args[cfg.livepageArg]}})
			return tostring(root)
	else
		return nil
	endnotice)
end

function p.protectionTemplate()
	if currentTitle.namespace == 10 then -- We are in the template namespace.
		local frame = mw.getCurrentFrame()

		local function getProtectionLevel(protectionType)
(contracted; show full)	if subpage == cfg.sandboxSubpage or subpage == 'testcases' then
		return currentTitle.baseText
	else
		return currentTitle.text
	end
end

return p