--require('strict')local getArgs = require('Module:Arguments').getArgslocal p = local pargs = -- parent argumentslocal lastNode=0local nodeCount=0local cladeCount=0local leafCount=0local templateStylesCount=0local infoOutputlocal reverseClade = false
--main|style= }}Template:CladeN
Release version:Usage: Template:Clade
function p.main(frame)
local cladeString = "" local maxChildren = 20 -- was 17 in the clade/cladex templates local childNumber = 0 local childCount = 0 -- number of leaves in the clade (can use to set bottom of bracket in addTaxon local totalCount = 0 pargs = getArgs(frame) -- parent arguments infoOutput = p.getCladeTreeInfo -- get info about clade structure, e.g. lastNode (last |N= child number) --add the templatestyles tag conditionally to reduce expansion size (currently diabled) when added to every clade table, it increases post‐expand include size significantly e.g. the Neosuchia page (or test version) is increase by about 8% (672 bytes each) if template styles added to all pages there are 133 stripmarkers with cladeCount
1 condition interfers with fix for additional line due to parser bug T18700 killing the strip markers also removes backlinks to references using citation templates --
--cladeString =mw.text.killMarkers(cladeString) -- also kills off strip markers using citation templates --cladeString = mw.text.unstrip(cladeString) --if cladeCountif tableStyle ~= "" then tableStyle = ' style="' .. tableStyle .. '"' -- include style= in string to suppress empty style elements end reverseClade =frame.args.reverse or pargs.reverse or false -- a global --ENFORCE GLOBAL FOR DEVELOPMENT --reverseClade = true
local captionName = pargs['caption'] or "" local captionStyle = pargs['captionstyle'] or ""
-- add an element to mimick nowiki WORKS BUT DISABLE FOR DEMO PURPOSES --cladeString = '
\n' -- open table -- (border-collapse causes problems (see talk) -- cladeString = cladeString .. '