K (Schützte „Modul:Hidden“ ([Bearbeiten=Nur Administratoren erlauben] (unbeschränkt) [Verschieben=Nur Administratoren erlauben] (unbeschränkt))) |
|||
Zeile 36: | Zeile 36: | ||
function p.main(frame) | function p.main(frame) | ||
− | local args = getArgs(frame) | + | local args |
+ | if frame == mw.getCurrentFrame() then | ||
+ | args = getArgs(frame) | ||
+ | else | ||
+ | args = frame | ||
+ | end | ||
args.header = args.header or args.title or (args[1] and mw.text.trim(args[1])) or '{{{header}}}' | args.header = args.header or args.title or (args[1] and mw.text.trim(args[1])) or '{{{header}}}' |
Version vom 2. April 2016, 20:28 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 depends on the following other modules: |
This module implements template {{Hidden}}.
Usage[Quelltext bearbeiten]
{{#invoke:Hidden|main}}
local p = {}
local getArgs = require( 'Module:Arguments' ).getArgs
function p._main(args)
div = mw.html.create( 'div' )
div:addClass( 'NavFrame' )
if not args.expanded then
div:addClass( 'collapsed' )
end
if args.class then
div:addClass( args.class )
end
div:css ( 'border', args.border )
:cssText ( args.style )
:tag( 'div' )
:addClass( 'NavHead' )
:css( 'font-weight', args.fw1 )
:css( 'background', args.bg1 )
:css( 'text-align', args.ta1 )
:cssText( args.headerstyle )
:wikitext( args.header )
:done()
:tag( 'div' )
:addClass( 'NavContent' )
:css( 'font-weight', args.fw2 )
:css( 'background', args.bg2 )
:css( 'text-align', args.ta2 )
:cssText( args.contentstyle )
:wikitext( args.content )
:done()
:done()
return tostring(div)
end
function p.main(frame)
local args
if frame == mw.getCurrentFrame() then
args = getArgs(frame)
else
args = frame
end
args.header = args.header or args.title or (args[1] and mw.text.trim(args[1])) or '{{{header}}}'
args.content = args.content or (args[2] and mw.text.trim(args[2])) or '{{{content}}}'
args.style = args.style or args.css or ''
args.border = args.border or 'none'
args.headerstyle = args.headerstyle or args.titlestyle or args.headercss or ''
args.contentstyle = args.contentstyle or args.contentcss or ''
args.fw1 = args.fw1 or 'bold'
args.fw2 = args.fw2 or 'normal'
args.bg1 = args.bg1 or 'transparent'
args.bg2 = args.bg2 or 'transparent'
args.ta1 = args.ta1 or 'center'
args.ta2 = args.ta2 or 'left'
return p._main(args)
end
return p