Difference between revisions of "Module:Clade/labels"

From blackwiki
Jump to navigation Jump to search
blackwiki>Jts1882
(create basic outline)
 
blackwiki>Jts1882
(fix)
Line 2: Line 2:
  
 
--local args =frame:getParent().args  -- get parent arguments
 
--local args =frame:getParent().args  -- get parent arguments
local args =frame.args -- use frame arguments
+
--local args = {}
 +
 
 +
p.getArgs = function(frame)
 +
return frame.args -- use frame arguments
 +
end
 
p.main = function(frame)
 
p.main = function(frame)
 
      
 
      
     --TO getargs function
+
     args = p.getArgs(frame)
 +
   
 
     local i = 1                        -- index for labels
 
     local i = 1                        -- index for labels
 
     local label = args['label'..i]    or ""
 
     local label = args['label'..i]    or ""

Revision as of 08:18, 10 November 2019

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

local p = {}

--local args =frame:getParent().args  -- get parent arguments
--local args = {}

p.getArgs = function(frame)
	return frame.args -- use frame arguments
end
p.main = function(frame)
     
    args = p.getArgs(frame) 
    
    local i = 1                        -- index for labels
    local label = args['label'..i]     or ""
    
    local style = args['style'..i] or "background-color:#ccffff;"  -- default for testing
    local top = args['top'..i]     or ""
    local left = args['left'..i]     or ""
    local right = args['right'..i]     or ""
    local bottom = args['bottom'..i]     or ""
    if top ~= ""    then top = 'top:'     .. top    .. ';' end  
    if left ~= ""   then top = 'left:'    .. left   .. ';' end  
    if right ~= ""  then top = 'right:'   .. right  .. ';' end  
    if bottom ~= "" then top = 'bottom:'  .. bottom .. ';' end 
    local position = top .. left .. right .. bottom
    
	output = '<div style="position:absolute;' .. style .. position .. '">' .. label .. '</div>'
	--background-color:#ffccff;top:75%;">
	return output
end

return p