Module:ScopeBox: Difference between revisions
From Amaranth Legacy, available at amaranth-legacy.community
More actions
Content deleted Content added
Tesinormed (talk | contribs) No edit summary |
Tesinormed (talk | contribs) No edit summary |
||
| Line 8: | Line 8: | ||
-- input validation |
-- input validation |
||
if not args['scope'] then error('"scope" argument is required') end |
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') |
local output = mw.html.create('div') |
||
Revision as of 06:51, February 4, 2025
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