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

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


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

	local wrapper = mw.html.create('div')
		:addClass('template-ScopeBox')
		:addClass('template-ScopeBox--' .. args['scope'])
	
	local content = mw.html.create('div')
		:addClass('template-ScopeBox-content')

	local left_symbol = content:tag('div')
	if args['left_symbol'] or args['symbol'] then
		left_symbol:wikitext('[[File:' .. (args['left_symbol'] or args['symbol'])  .. '|80px|link=|alt=]]')
	end

	content:tag('div')
		:wikitext('[[Scope:' .. args['scope'] .. '|' .. args['scope'] .. ']]')
		:done()

	local right_symbol = content:tag('div')
	if args['right_symbol'] or args['symbol'] then
		right_symbol:wikitext('[[File:' .. (args['right_symbol'] or args['symbol'])  .. '|80px|link=|alt=]]')
	end

	wrapper:node(content)

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

return p