Modul:RubrikContainer
Aus Sacra.Wiki
Ansichten
Aktionen
Namensräume
Varianten
Werkzeuge
Die Dokumentation für dieses Modul kann unter Modul:RubrikContainer/Doku erstellt werden
local p = {}
local arguments = require( 'Module:Arguments' )
local args = {}
-- Container Output
function p.output( frame )
args = arguments.getArgs( frame )
local section = mw.html.create( 'div' )
section
:addClass( 'category-container' )
if args[ 'content' ] == nil or string.len( args[ 'content' ] ) == 0 then
section
:addClass( 'no-content' )
else
section
:addClass( 'content' )
end
if args[ 'image' ] == nil or string.len( args[ 'image' ] ) == 0 then
section
:addClass( 'no-image' )
else
section
:addClass( 'image' )
end
local heading = mw.html.create( 'h2' )
heading
:wikitext( args[ 'head_content' ] )
section:node( heading )
local contentDiv = mw.html.create( 'div' )
if args[ 'content' ] ~= nil then
local textContainer = mw.html.create( 'div' )
textContainer
:addClass( 'category-content-container' )
:wikitext( args[ 'content' ] )
contentDiv:node( textContainer )
end
if args[ 'image' ] ~= nil then
local imageContainer = mw.html.create( 'div' )
local imageContain = ''
if args[ 'image_contain' ] ~= nil then
imageContain = 'image-contain'
end
if args[ 'image_class' ] ~= nil then
imageContain = imageContain .. ' ' .. args[ 'image_class' ]
end
imageContainer
:addClass( 'category-image-container' )
:wikitext( '[[' .. args[ 'image' ] .. '|alternativtext=' .. ( args[ 'image_alt' ] or '' ) .. '|rahmenlos|' .. ( args[ 'image_size' ] or '800px' ) .. '|link=' .. ( args[ 'image_link' ] or '' ) .. '|class=' .. imageContain .. ']]' )
contentDiv:node( imageContainer )
end
section:node( contentDiv )
return tostring( section )
end
return p