Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
DOORS Site Logo

Welcome to the Official DOORS Wiki!
Please read the Wiki Rules the Manual of Style and familiarise yourself with our Wiki Policies before contributing to get a better understanding of what content is allowed on our wiki and how to display it properly, if you need help don't hesitate to reach out to a DOORS Wiki Staff Member.

Editing Module:Mbox

From DOORS Wiki
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 13: Line 13:
-- or look at https://dev.fandom.com/wiki/Global_Lua_Modules/Mbox
-- or look at https://dev.fandom.com/wiki/Global_Lua_Modules/Mbox
-- for more customization inspiration
-- for more customization inspiration

--
-- BEGIN DELETION HERE
--

local getArgs = require('Dev:Arguments').getArgs
local localCSS = mw.loadData('Module:Mbox/data').localStyle

function Mbox.main(frame)
local args = getArgs(frame)

-- styles
local styles = {}
if args.bordercolor then
styles['border-left-color'] = args.bordercolor
elseif args.type then
styles['border-left-color'] = 'var(--type-' .. args.type .. ')'
end

if args.bgcolor then
styles['background-color'] = args.bgcolor
end

-- images
local image = args.image or ''
local imagewidth = args.imagewidth or '80px'
local imagelink = ''
if args.imagelink then
imagelink = '|link=' .. args.imagelink
end

local imagewikitext = ('%sFile:%s|%s%s' .. ']]'):format('[[', image, imagewidth, imagelink)

-- id for closure
local id = args.id or 'mbox'

local container = mw.html.create('div')
:addClass('mbox')
:addClass(args.class)
:css(styles)
:css(localCSS['mbox'])
:cssText(args.style)

local content = container:tag('div')
:addClass('mbox__content')
:css(localCSS['mbox__content'])

if args.image then
local image = content:tag('div')
:addClass('mbox__content__image')
:addClass('mw-collapsible')
:attr('id', 'mw-customcollapsible-' .. id)
:css(localCSS['mbox__content__image'])
:wikitext(imagewikitext)
if args.collapsed then
image:addClass('mw-collapsed')
end
end

local contentwrapper = content:tag('div')
:addClass('mbox__content__wrapper')
:css(localCSS['mbox__content__wrapper'])

if args.header then
contentwrapper:tag('div')
:addClass('mbox__content__header')
:css(localCSS['mbox__content__header'])
:wikitext(args.header)
end

if args.text then
local text = contentwrapper:tag('div')
:addClass('mbox__content__text')
:addClass('mw-collapsible')
:attr('id', 'mw-customcollapsible-' .. id)
:css(localCSS['mbox__content__text'])
:wikitext(args.text)
if args.collapsed then
text:addClass('mw-collapsed')
end

if args.comment then
text:tag('div')
:addClass('mbox__content__text__comment')
:css(localCSS['mbox__content__text__comment'])
:wikitext(args.comment)
end
end

contentwrapper:tag('span')
:addClass('mbox__close')
:addClass('mw-customtoggle-' .. id)
:css(localCSS['mbox__close'])
:attr('title', 'Dismiss')

if args.aside then
local aside = content:tag('div')
:addClass('mbox__content__aside')
:addClass('mw-collapsible')
:attr('id', 'mw-customcollapsible-' .. id)
:css(localCSS['mbox__content__aside'])
:wikitext(args.aside)
if args.collapsed then
aside:addClass('mw-collapsed')
end
end

return container
end

--
-- END DELETION HERE
--


-- The last line produces the output for the template
-- The last line produces the output for the template
Please note that all contributions to DOORS Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see DOORS Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Below are some commonly used wiki markup codes. Simply click on what you want to use and it will appear in the edit box above.

View this template