Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
You must create an account or log in to edit.
Revision as of 06:51, February 4, 2025 by Tesinormed (talk | contribs)

This module is used for Template:ScopeBox. See the template's page for more information.


local libraryUtil = require('libraryUtil')
local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg

local p = {}

function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame)
	-- input validation
	if not args['scope'] then error('"scope" argument is required') end
	if not args['symbol'] and not (args['left_symbol'] and args['right_symbol']) then error('"symbol" argument is required') end

	local output = mw.html.create('div')
		:addClass('template-ScopeBox')
		:addClass('template-ScopeBox--' .. args['scope'])
		:tag('div')
			:addClass('template-ScopeBox-content')
			:tag('div')
			:wikitext('[[File:' .. (args['left_symbol'] or args['symbol'])  .. '|80px|link=|alt=]]')
			:done()
			:tag('div')
			:wikitext('[[Scope:' .. args['scope'] .. '|' .. args['scope'] .. ']]')
			:done()
			:tag('div')
			:wikitext('[[File:' .. (args['right_symbol'] or args['symbol'])  .. '|80px|link=|alt=]]')
			:done()
		:done()

	return frame:extensionTag { name = 'templatestyles', args = { src = 'Module:ScopeBox/styles.css' } }
		.. frame:extensionTag { name = 'templatestyles', args = { src = 'Module:ScopeBox/styles-' .. args['scope'] .. '.css' } }
		.. tostring(output)
end

return p