Modul:Collapse
This is [[MediaWiki:Tagline]]. Set to <code>display:none</code> by chameleon skin.
This module is rated as ready for general use. It has reached a mature form and is thought to be bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
This module DOES NOT implement template {{Collapse}}. It copies that template's function, though.
Usage
{{#invoke:Collapse|main}}
The above documentation is transcluded from Modul:Collapse/doc. (edit | history) Subpages of this module. |
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
function p._main(args)
local html = mw.html.create('table')
html:addClass('navbox')
:addClass('mw-collapsible')
:addClass(not yesno(args.expand) and 'mw-collapsed')
:cssText('text-align: left; border: ' .. (args.expand or '1px') .. ' solid silver; margin-top: 0.2em; background: ' .. (args.bg1 or 'transparent') .. (args.width and '; width: ' .. args.width or ''))
:tag('tr')
:tag('th')
:cssText('background-color: ' .. (args.bg or '#CFC') ..'; text-align: ' .. (yesno(args.left) and 'left' or 'center') .. '; font-size:112%; color: ' .. (args.fc or 'black'))
:wikitext(args[1] or args.title or args.reason or args.header or args.heading or 'Extended content')
:done()
:done()
:tag('tr')
:tag('td')
:cssText('border: solid ' .. (args.border2 or '1px silver') .. '; padding: ' .. (args.padding or '8px') .. '; background-color: ' .. (args.bg2 or 'white') .. '; font-size: 112%')
:wikitext(args[2] or args.text or args.content)
:done()
:done()
return tostring(html)
end
function p.main(frame)
local args
if frame == mw.getCurrentFrame() then
args = getArgs(frame)
else
args = frame
end
return p._main(args)
end
return p