Modul:Collapse

Permanently protected module
IMT HilfeWiki - das Wiki
Documentation icon Module documentation

This module DOES NOT implement template {{Collapse}}. It copies that template's function, though.

Usage[Quelltext bearbeiten]

{{#invoke:Collapse|main}}

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
Cookies helfen uns bei der Bereitstellung des IMT HilfeWikis. Bei der Nutzung vom IMT HilfeWiki werden die in der Datenschutzerklärung beschriebenen Cookies gespeichert.