Module:Protocol

From DAAP
Jump to navigation Jump to search

Documentation for this module may be created at Module:Protocol/doc

local p = {}
 
 function p.getTitle(f)
 	result = nil 
 	if f.args.Title == nil or f.args.Title == '' then 
 	 	result = tostring(mw.title.getCurrentTitle()) 
  	else
  		result = f.args.Title
 	end
 	return result 
 end
 
 function p.getContact(f)
 	result = nil 
 	if f.args.Contact == nil or f.args.Contact == '' then 
 	 	result = "" 
  	else
  		result = f.args.Contact
 	end
 	return result 
 end
 
 function p.getWebsite(f)
 	result = nil 
 	if f.args.Website == nil or f.args.Website == '' then 
 	 	result = "" 
  	else
  		result = '['.. f.args.Website .. ' Website]'
 	end
 	return result 
 end
 
 function p.getEmail(f)
 	result = nil 
 	if f.args.Email == nil or f.args.Email == '' then 
 	 	result = "" 
  	else
  		result = '[mailto:'.. f.args.Email ..' '.. f.args.Email ..']'
 	end
 	return result 
 end
 
  function p.getKeywords(f)
 	result = nil 
 	if f.args.Keywords  == nil or f.args.Keywords  == '' then 
 	 	result = "" 
  	else
  		result = f.args.Keywords 
 	end
 	return result 
 end
 
function p.infobox(f)
	local capiunto = require 'capiunto'
	return capiunto.create( {
	    -- bodyStyle = 'border: 15px solid red',
		title =  p.getTitle(f)  ,
		top = 'Protocol',
		topStyle = 'background:#cfc;font-size:larger',
		bottom = p.getWebsite(f)
	} )
	:addRow('Contact', p.getContact(f))
	:addRow('Keywords',  p.getKeywords(f))
	:addRow('Email', p.getEmail(f))
	:addWikitext( "[[Category:Protocol]]" )
end
 
return p