local p = {}
local pargs
function p.main(frame)
pargs = frame:getParent().args
local args = {}
local i=1
local contentString = ""
local max = getMax()
if pargs'inverse' then
contentString = p.inverseClade(frame,max,max)
else
contentString = p.clade(frame,1,max)
end
return contentString
end
function p.clade(frame,i,max) -- |1= is basal at top
local args = {}
args1 = pargs i
args'label1' = pargs 'label'..tostring(i)]
args'sublabel1' = pargs 'sublabel'..tostring(i)]
if i+1 == max then
args2 = pargs i+1
args'label2' = pargs 'label'..tostring(i+1)]
args'sublabel2' = pargs 'sublabel'..tostring(i+1)]
else
args2 = p.clade(frame,i+1,max) -- or the result of the next pair
end
local template = "Clade"
if pargs 'reverse' then template = "CladeR" end
return frame:expandTemplate{ title = template, args = args }
end
function p.inverseClade(frame,i,max) -- |1= innermost at bottom
local args = {}
args2 = pargs i
args'label2' = pargs 'label'..tostring(i)]
args'sublabel2' = pargs 'sublabel'..tostring(i)]
if i-1 == 1 then
args1 = pargs i-1
args'label1' = pargs 'label'..tostring(i-1)]
args'sublabel1' = pargs 'sublabel'..tostring(i-1)]
else
args1 = p.inverseClade(frame,i-1,max) -- or the result of the next pair
end
local template = "Clade"
if pargs 'reverse' then template = "CladeR" end
return frame:expandTemplate{ title = template , args = args }
end
function p.inverseClade2(frame,i,max) -- |1= is innermost at bottom
local args = {}
args1 = pargs i
args'label1' = pargs 'label'..tostring(i)]
if i-1 == 1 then
args2 = pargs i-1
args'label2' = pargs 'label'..tostring(i-1)]
else
args2 = p.inverseClade(frame,i-1,max) -- or the result of the next pair
end
return frame:expandTemplate{ title = "Clade", args = args }
end
function getMax()
local i=1
local max
while i<50 do
if pargs i then
max = i
i=i+1
else
break
end
end
return max
end
return p
local p = {}
local pargs
function p.main(frame)
pargs = frame:getParent().args
local args = {}
local i=1
local contentString = ""
local max = getMax()
if pargs'inverse' then
contentString = p.inverseClade(frame,max,max)
else
contentString = p.clade(frame,1,max)
end
return contentString
end
function p.clade(frame,i,max) -- |1= is basal at top
local args = {}
args1 = pargs i
args'label1' = pargs 'label'..tostring(i)]
args'sublabel1' = pargs 'sublabel'..tostring(i)]
if i+1 == max then
args2 = pargs i+1
args'label2' = pargs 'label'..tostring(i+1)]
args'sublabel2' = pargs 'sublabel'..tostring(i+1)]
else
args2 = p.clade(frame,i+1,max) -- or the result of the next pair
end
local template = "Clade"
if pargs 'reverse' then template = "CladeR" end
return frame:expandTemplate{ title = template, args = args }
end
function p.inverseClade(frame,i,max) -- |1= innermost at bottom
local args = {}
args2 = pargs i
args'label2' = pargs 'label'..tostring(i)]
args'sublabel2' = pargs 'sublabel'..tostring(i)]
if i-1 == 1 then
args1 = pargs i-1
args'label1' = pargs 'label'..tostring(i-1)]
args'sublabel1' = pargs 'sublabel'..tostring(i-1)]
else
args1 = p.inverseClade(frame,i-1,max) -- or the result of the next pair
end
local template = "Clade"
if pargs 'reverse' then template = "CladeR" end
return frame:expandTemplate{ title = template , args = args }
end
function p.inverseClade2(frame,i,max) -- |1= is innermost at bottom
local args = {}
args1 = pargs i
args'label1' = pargs 'label'..tostring(i)]
if i-1 == 1 then
args2 = pargs i-1
args'label2' = pargs 'label'..tostring(i-1)]
else
args2 = p.inverseClade(frame,i-1,max) -- or the result of the next pair
end
return frame:expandTemplate{ title = "Clade", args = args }
end
function getMax()
local i=1
local max
while i<50 do
if pargs i then
max = i
i=i+1
else
break
end
end
return max
end
return p