Module:Clade/hidden

local p = {}

function p.hidden(frame) local id = mw.getCurrentFrame:getParent.args['id'] or "" local mode = mw.getCurrentFrame:getParent.args['mode'] or "right" local expandSymbol = mw.getCurrentFrame:getParent.args['expand-symbol'] or "&#8862;" local collapseSymbol = mw.getCurrentFrame:getParent.args['collapse-symbol'] or "&#8863;" local expandText = mw.getCurrentFrame:getParent.args['expand-text'] or "" local collapseText = mw.getCurrentFrame:getParent.args['collapse-text'] or "" local initialStateExpanded = mw.getCurrentFrame:getParent.args['expanded'] or "false" if mw.getCurrentFrame:getParent.args['expand-symbol'] == "none" then expandSymbol = expandText else expandSymbol = expandSymbol .. expandText end if mw.getCurrentFrame:getParent.args['collapse-symbol'] == "none" then collapseSymbol = collapseText else collapseSymbol = collapseSymbol .. collapseText end -- default is content collapsed local contentState = " mw-collapsed" -- class to collapse content at start local collapseSymbolState = " mw-collapsed" local expandSymbolState = "" if initialStateExpanded == "true" or initialStateExpanded  == "yes" then contentState = "" collapseSymbolState = "" expandSymbolState = " mw-collapsed" end -- collapsible element containing the EXPAND SYMBOL and/or text --local expandSymbolString = '' -- mobile exclusion no longer necessary local expandSymbolString = '' .. ' '               .. ' '                .. '' .. expandSymbol .. ' '               .. '   '    -- collapsible element containing the CLADE CONTENT local clade = require( 'Module:Clade' ) local contentString = '' .. ' '               .. '' -- don't toggle on the content .. '\n' .. clade.main(frame) -- important to start wikitext tables on new line .. '  '    -- collapsible element containing the COLLAPSE SYMBOL and/or text --local collapseSymbolString = '' -- mobile exclusion no longer necessary local collapseSymbolString = '' .. '' .. ' '               .. '' .. collapseSymbol .. ' '                           .. '   '

local tableStyle = frame.args.style or "" if tableStyle == '' then tableStyle = "" end local cladeString = ' '

return p.templateStyle( frame, "Clade hidden/styles.css" ) .. cladeString end

function p.toggle(frame) if 1==2 then return 'some text' end --local toggleSymbol = 'toggle all' local toggleSymbol = mw.getCurrentFrame:getParent.args['button'] or ""

local toggleString = '<div class="'   local i=0    while 	i < 20 do  -- limit on number of toggle elements controlled by the trigger button    	i = i + 1 -- so we start with 1		local target = mw.getCurrentFrame:getParent.args['id'..tostring(i)] 	    -- add classes for the three elements of each target: expand symbol, collapse symbol and contents	    if target ~= nil then            toggleString = toggleString .. ' mw-customtoggle-myClade' .. target                 ..             ' mw-customtoggle-collapseSymbol' .. target                 ..             ' mw-customtoggle-expandSymbol' .. target         end    end toggleString = toggleString  ..  '">' .. toggleSymbol .. ' '

return toggleString end

--  function p.templateStyle( frame, src ) return frame:extensionTag( 'templatestyles', '', { src = src } ); end

return p