Modulo:Wim b

Wikibooks, manuali e libri di testo liberi.

La documentazione per questo modulo può essere creata in Modulo:Wim b/man

local mMessageBox = require('Module:Message box')

local p = {}

function p.main(frame)
	local boxArgs = {}
	local bug = frame.args[1]
	local colore, testo, status, task, preposizione
	
	if bug == '' or bug == nil then 
		testo = '<strong class="error">Template lasciato vuoto</strong>'
	else
		status = mw.ustring.match(bug, '-(%a+[%s*%a*]*)');
		task = mw.ustring.match(bug, '(%a[%d]*)-');
		if status ~= '' and task == '' then
			testo = 'nessuno stato'
			
		elseif bug ~= '' and status == 'risolto' then
			colore = 'green'
			preposizione = 'considerato'
			
		elseif bug ~= '' and status == 'chiuso' then
			colore = '#0060FF'
			preposizione = 'considerato'
			
		elseif bug ~= '' and status == 'aperto' then
			colore = 'black'
			preposizione = 'attualmente'
			
		elseif bug ~= '' and status == 'invalido' or bug ~= '' and status == 'non valido' then
			colore = 'red'
			status ='non valido'
			preposizione = 'stato considerato'
		end
	testo = 'il task [[phab:'..task..'|'..task..']] è '..preposizione..' <br> <span style=" color:'.. colore ..'; font-weight:bold; text-transform:uppercase">'..status..'</span>' --..stato
	
end	

	boxArgs.tipo = 'avviso'
	boxArgs.small = true
	boxArgs.immagine = '[[File:Favicon-Phabricator-WM.svg|30px|alt=|link=]]'
	
	boxArgs.testo = testo
	return mMessageBox.main('ombox', boxArgs)
end

return p