Jump to content

Module:Clade/labels

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Jts1882 (talk | contribs) at 09:18, 10 November 2019 (switch to parent arguments for template use). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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 = ""
    --[[local groupStyle = args['style']
    local topStyle = args['top']
    local leftStyle = args['left']
    local rightStyle = args['right']
    local bottomStyle = args['bottom']
    ]]
    
    while  args['label'..i] do
    	
	    local label = args['label'..i]     or ""
	    
	    local style  = args['style'..i]  or args['style']  or ""  
	    local top    = args['top'..i]    or args['top']    or ""
	    local left   = args['left'..i]   or args['left']   or ""
	    local right  = args['right'..i]  or args['right']  or ""
	    local bottom = args['bottom'..i] or args['bottom'] or ""
	    if top ~= ""    then top    = 'top:'     .. top    .. ';' end  
	    if left ~= ""   then left   = 'left:'    .. left   .. ';' end  
	    if right ~= ""  then right  = 'right:'   .. right  .. ';' end  
	    if bottom ~= "" then bottom = 'bottom:'  .. bottom .. ';' end 
	    local position = top .. left .. right .. bottom
	    
		output = output .. '<div style="position:absolute;' .. style .. position .. '">' .. label .. '</div>'
		--background-color:#ffccff;top:75%;">
		i=i+1
	end
	return output
end

return p