Difference between revisions 51779 and 51780 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)		.wikitext(p.protectionTemplate())
		.wikitext(p.sandboxNotice(args))
		 -- This div tag is from {{documentation/start box}}, but moving it here
		 -- so that we don't have to worry about unclosed tags.
		.tag('div')
			.attr('id', formatMessage('mainDivId', 'string'))
			.addClass(formatMessage('mainDivClasses', 'string'))

			.newline()
			.wikitext(p._startBox(args))
			.wikitext(p._content(args))
			.tag('div')
				.css('clear', 'both') -- So right or left floating items don't stick out of the doc box.
				.newline()
				.done()
			.done()
		.wikitext(p._endBox(args))
		.newline()
		.wikitext(p.addTrackingCategories())
	return tostring(root)
end

function p.sandboxNotice(args)
	local sandboxNoticeTemplate = formatMessage('sandboxNoticeTemplate', 'string')
	if not (sandboxNoticeTemplate and currentTitle.subpageText == formatMessage('sandboxSubpage', 'string')) then
		return nil
(contracted; show full)	end

	-- Build the start box div.
	local sbox = htmlBuilder.create('div')
	sbox
		.css('padding-bottom', '3px')
		.css('border-bottom', '1px solid #aaa')
		.css('margin-bottom', '1ex')

		.newline()

	-- Make the heading.
	local hspan = sbox.tag('span')
	if headingStyle then
		hspan.cssText(headingStyle)
	elseif subjectSpace == 10 then
		-- We are in the template or template talk namespaces.
(contracted; show full)	if subpage == formatMessage('sandboxSubpage', 'string') or subpage == formatMessage('testcasesSubpage', 'string') then
		return currentTitle.baseText
	else
		return currentTitle.text
	end
end

return p