K (Schützte „Modul:Collapse“: Automatic protection of selected project pages ([Bearbeiten=Nur Administratoren erlauben] (unbeschränkt) [Verschieben=Nur Administratoren erlauben] (unbeschränkt))) |
|||
(Eine dazwischenliegende Version von einem anderen Benutzer wird nicht angezeigt) |
Aktuelle Version vom 6. April 2023, 19:19 Uhr
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[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