Modulo:Phabricator

Wikibooks, manuali e libri di testo liberi.

La documentazione per questo modulo può essere creata in Modulo:Phabricator/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, tipo
	
	if bug == '' or bug == nil then 
		testo = '<strong class="error">Template lasciato vuoto</strong>'
		tipo = 'cancella'
	else
		status = mw.ustring.match(bug, '-(%a+[%s*%a*]*)');
		task = mw.ustring.match(bug, '(%a[%d]*)-');
		if status ~= '' and task == '' then
			status = 'nessuno stato'
			
		elseif bug ~= '' and status == 'risolto' then
			colore = 'green'
			preposizione = 'considerato'
			
		elseif bug ~= '' and status == 'stallo' then
			colore = '#f28500'
			preposizione = 'stato messo'
			tipo = 'contenuto'
			status = 'in stallo' 
			
		elseif bug ~= '' and status == 'aperto' then
			colore = 'black'
			preposizione = 'attualmente'
		
		elseif bug ~= '' and status == 'riaperto' then
			colore = '#0060FF'
			preposizione = 'stato'
			tipo = 'protezione'
		
		elseif bug ~= '' and status == 'rigettato' then
			colore = 'red; text-decoration: line-through'
			preposizione = 'stato'
			tipo = 'immediata'
			
		elseif bug ~= '' and status == 'invalido' or bug ~= '' and status == 'non valido' then
			colore = 'red; text-decoration: line-through'
			tipo = 'cancella'
			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 = tipo
	boxArgs.small = true
	boxArgs.immagine = '[[File:Favicon-Phabricator-WM.svg|30px|alt=|link=]]'
	boxArgs.testo = testo
	return mMessageBox.main('ombox', boxArgs)
end

return p