When you use the Scribunto extension, the BootstrapComponents extension provides you with an easy access to the available components inside your lua script. Also, there is a utility function, to get the name of the skin in use. The available lua functions are:
This function parses a bootstrap component, taking input text and arguments from the function parameters:
-- @param string component the name of the component, you want to parse
-- @param string input the text inside the tags or - for parser functions - after the :
-- @param table arguments the arguments of the tag or parser function
--
-- @return string
mw.bootstrap.parse( component, input, arguments )
The parse function takes up to three parameters and returns the parsed component as string. The parameters are:
- component (string)
- This is the name of the component, you wish to parse. E.g. "icon", "panel", etc.
- input (string)
- The input string for your component. For tags, this is the part usually put in between the opening and closing part of the tag. For parser functions, this is the text right after the double colon.
- arguments (table)
- If you want/need to pass additional arguments put them in this table.
local tooltip = mw.bootstrap.parse( 'tooltip', 'ambiguous', { text='better explanation' } )
local panel1 = mw.bootstrap.parse(
'panel',
'This is the text inside the panel1. It it quite ' .. tooltip,
{ color = 'success', footer = 'information at the base', collapsible = true }
)
local panel2 = mw.bootstrap.parse(
'panel',
'This is the text inside the panel2. It it quite ' .. tooltip,
{ color = 'success', footer = 'information at the base', collapsible = true }
)
local accordion = mw.bootstrap.parse(
'accordion',
panel1 .. panel2
)
return accordion
For information about the existing components and their available arguments, please visit the components documentation
This function returns the currently active skin.
-- no parameters
--
-- @return string (lower case)
mw.bootstrap.getSkin()
local skin = mw.bootstrap.getSkin()
if skin == 'vector' then
--
elseif skin == 'chameleon' then
--
else
--
end