Module:Clade/labels
local p = {}
 
 --local args =frame:getParent().args  -- get parent arguments
 --local args = {}
 
 p.getArgs = function(frame) 
 	--return frame.args              -- use frame arguments
 	return frame:getParent().args  -- use parent arguments
 end
 p.main = function(frame)
      
     args = p.getArgs(frame) 
     
     local i = 1                     -- index for labels
     local output = &quot;&quot;
     --[[local groupStyle = args['style']
     local topStyle = args['top']
     local leftStyle = args['left']
     local rightStyle = args['right']
     local bottomStyle = args['bottom']
     ]]
     -- parameters for all labels
     local width = args['width'] -- or &quot;5em;&quot;
     --local style = args['style'] or &quot;&quot;
     --local color = args['width'] or &quot;&quot;
     
     local longestString = 0
     
     while  args['label'..i] do
     	
 	    local label = args['label'..i]     or &quot;&quot;
 	    if #label &gt; longestString then longestString = #label end
 	    
 	    local style  = args['style'..i]  or args['style']  or &quot;&quot;  
 	    local color  = args['color'..i]  or args['color']  or &quot;&quot;  
 	    local top    = args['top'..i]    or args['top']    or &quot;&quot;
 	    local left   = args['left'..i]   or args['left']   or &quot;&quot;
 	    local right  = args['right'..i]  or args['right']  or &quot;&quot;
 	    local bottom = args['bottom'..i] or args['bottom'] or &quot;&quot;
 	    if top ~= &quot;&quot;    then top    = 'top:'     .. top    .. ';' end  
 	    if left ~= &quot;&quot;   then left   = 'left:'    .. left   .. ';' end  
 	    if right ~= &quot;&quot;  then right  = 'right:'   .. right  .. ';' end  
 	    if bottom ~= &quot;&quot; then bottom = 'bottom:'  .. bottom .. ';' end 
 	    if color ~= &quot;&quot;  then color  = 'color:'   .. color .. ';' end
 	    --if no color:find(&quot;;&quot;, -1, true)  then color = color .. ';' end
 	   
 	    
 	    --local position = top .. left .. right .. bottom
 	    
 		output = output .. '&lt;div style=&quot;position:absolute;white-space:nowrap;' 
 		                .. style .. color                                       -- CSS styling
 		                .. top .. left .. right .. bottom .. '&quot;&gt;'               -- position of label
 		                .. label                                                -- content of label
 		                .. '&lt;/div&gt;'
 		i=i+1
 	end
 	if output ~= &quot;&quot; then
 		local styleStr = &quot;&quot;
 		--widthStr = 'width:' .. (longestString*0.5)..'em;' -- can't take account of formatting or &lt;br/&gt;
 		if width then styleStr = 'style=&quot;width:' .. width .. '&quot;' end
  		
 		output = '&lt;div ' .. styleStr ..'&gt;' .. output .. '&lt;/div&gt;'
 	end
 	return output
 end
 
 p.label = function(frame)
      
     args = p.getArgs(frame) 
     
     local i = 1                     -- index for labels
     local output = &quot;&quot;
     local label = args['label'..i] or  args['label'] or args[1]   or &quot;&quot;
     local width = args['width']
     
 	    local style  = args['style'..i]  or args['style']  or &quot;&quot;  
 	    local color  = args['color'..i]  or args['color']  or &quot;&quot;  
 	    local top    = args['top'..i]    or args['top']    or &quot;&quot;
 	    local left   = args['left'..i]   or args['left']   or &quot;&quot;
 	    local right  = args['right'..i]  or args['right']  or &quot;0px&quot;
 	    local bottom = args['bottom'..i] or args['bottom'] or &quot;&quot;
 	    if top ~= &quot;&quot;    then top    = 'top:'     .. top    .. ';' end  
 	    if left ~= &quot;&quot;   then left   = 'left:'    .. left   .. ';' end  
 	    if right ~= &quot;&quot;  then right  = 'right:'   .. right  .. ';' end  
 	    if bottom ~= &quot;&quot; then bottom = 'bottom:'  .. bottom .. ';' end 
 	    if color ~= &quot;&quot;  then color  = 'color:'   .. color .. ';' end
  
 		output = output .. '&lt;div style=&quot;position:absolute;white-space:nowrap;' 
 		                .. style .. color                                       -- CSS styling
 		                .. top .. left .. right .. bottom .. '&quot;&gt;'               -- position of label
 		                .. label                                                -- content of label
 		                .. '&lt;/div&gt;'
 
 
 	if output ~= &quot;&quot; then
 		local widthStr = ''
 		if width then widthStr = 'width:' .. width .. ';' end
  		
 		output = '&lt;div style=&quot;position:relative;' .. widthStr .. '&quot;&gt;' .. output .. '&lt;br/&gt;&lt;/div&gt;'
 	end
         
     return output
     
 end