Mòdul:Infobox/Títol

Un article de Wikipèdia, l'enciclopèdia liura.

La documentacion d'utilizacion d'aquel modul se pòt crear a Mòdul:Infobox/Títol/ús

local p = { }

local trim = require( 'Mòdul:Aisinas' ).trim

function p.templatestyles( pictograma )
	pictograma = trim( pictograma )
	if not pictograma then
		return ''
	end
	pictograma = trim( pictograma
		:gsub( '^entesta ', '' )
		:gsub( '^entesta$', '' )
		:gsub( ' entesta$', '' )
		:gsub( ' entesta ', ' ' )
    )
	if pictograma and pictograma ~= 'defaut' then
		if pictograma:match( '%s' ) then
			return '[[Categoria:Infobox ambe mantuna class]]'
		else
			return mw.getCurrentFrame():extensionTag( 
				'templatestyles',
				'',
				{ src = 'Infobox/Pictograma/' .. mw.text.trim( pictograma ) .. '.css' }
			)
		end
	end
	return ''
end

function p.colors( background, color )
	local color = require( 'Mòdul:Dièsi color web' ).color
	background = trim( background ) or '#E1E1E1'
	color = trim( color ) or 'black'
	
	return 'background-color:' .. color( background ) .. ';'
		.. 'color:' .. color( color ) .. ';'
end

function p.V2( frame )
	local args =  frame.getParent and frame:getParent().args or frame
	local colspan = trim( args[5] ) or '2'
	local texte = trim( args[1] ) or mw.title.getCurrentTitle().text
	local classes = trim( args[3] ) or 'defaut'
	
	return 'colspan="' .. colspan .. '" '
		.. 'class="entesta ' .. classes .. '" '
		.. 'style="' .. p.colors( args[2], args[4] ) .. '" '
		.. ' | '
		.. texte
		.. p.templatestyles( args[3] )
end

return p