Modul:Großes Stirnband

Aus Vikidia
Zur Navigation springen Zur Suche springen

Die Dokumentation für dieses Modul kann unter Modul:Großes Stirnband/Doku erstellt werden

local p = {}

--
-- Fonction qui génère le bandeau
--

function p.bandeau( canari, titre, texte, couleur_fond, couleur_bord, image_gauche, image_droite )
	if canari ~= nil then
		error( 'utilisez la fonction « BandeauGrand » du [[module : Divers bandeaux]]' )
	end

	local html = mw.html.create( 'div' )
	html:addClass( 'plainlinks' )
	    :css( 'display', 'table' )
	    :css( 'box-sizing', 'border-box' )
	    :css( 'width', '70%' )
	    :css( 'clear', 'right' )
	    :css( 'clear', 'both' ) -- semble ne pas marcher
	    :css( 'margin', 'auto' )
	    :css( 'margin-bottom', '10px' )
	    :css( 'padding', '3px' )
	    :css( 'border-width', '0 12px 3px 0' )
	    :css( 'border-style', 'solid' )
	    :css( 'background-color', couleur_fond or 'white' )
	    :css( 'border-color', couleur_bord or '#AAA' )
	    :css( 'text-align', 'center' )

	if image_gauche then
		html:tag( 'div' ):addClass( 'nomobile' )
		                 :css( 'display', 'table-cell' )
		                 :css( 'vertical-align', 'middle' )
		                 :css( 'width', '100px' )
		                 :node( image_gauche )
		                 :done()
	end

	html:tag( 'div' ):css( 'display', 'table-cell' )
	                 :css( 'vertical-align', 'middle' )
	                 :wikitext( titre and ( '<b>' .. titre .. '</b><br />' ))
	                 :wikitext( texte or 'Texte à compléter' )

	if image_droite then
		html:tag( 'div' ):addClass( 'nomobile' )
		                 :css( 'display', 'table-cell' )
		                 :css( 'vertical-align', 'middle' )
		                 :css( 'width', '100px' )
		                 :node( image_droite )
		                 :done()
	end

	return html
end

--
-- Fonctions pour créer les images
--

function p.BannerBild( canari, Bild )
	if canari ~= nil then
		error( 'die Funktion "BannerBild" ist nicht für die direkte Verwendung gedacht' )
	end

	if not image then return nil end
	local html = mw.html.create()
	return html:wikitext( '[[Datei:' .. Bild .. '|50px|link=|alt=|class=noviewer]]' )
end

function p.imageCC( canari, args )
	if canari ~= nil then
		error( 'die Funktion "imageCC" ist nicht für den direkten Gebrauch bestimmt' )
	end

	local image = mw.html.create( 'div' )
	image:tag( 'div' ):wikitext( '[[Datei:CC Some rights reserved.svg|90px|alt=|link=|class=noviewer]]' )
	                  :done()
	     :tag( 'div' )

	if args.BY then
		image:wikitext( '[[Datei:CC-BY.svg|30px|alt=|link=|class=noviewer]]' )
		if args.NC then
			image:wikitext( '[[Datei:CC-NC.svg|30px|alt=|link=|class=noviewer]]' )
		end
		if args.SA then
			image:wikitext( '[[Datei:CC-SA.svg|30px|alt=|link=|class=noviewer]]' )
		elseif args.ND then
			image:wikitext( '[[Datei:CC-ND.svg|30px|alt=|link=|class=noviewer]]' )
		end
	elseif args.PD then
		image:wikitext( '[[Datei:CC-PD.svg|30px|alt=|link=|class=noviewer]]' )
	elseif args.ZERO then
		image:wikitext( '[[Datei:CC0.svg|30px|alt=|link=|class=noviewer]]' )
	elseif args.SA then -- il a existé une CC SA 1.0, qui est déconseillée
		image:wikitext( '[[Datei:CC-SA.svg|30px|alt=|link=|class=noviewer]]' )
	end
	return image
end

return p