<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mbwiki.stairwaygames.work/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AAccordion</id>
	<title>Module:Accordion - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mbwiki.stairwaygames.work/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AAccordion"/>
	<link rel="alternate" type="text/html" href="https://mbwiki.stairwaygames.work/w/index.php?title=Module:Accordion&amp;action=history"/>
	<updated>2026-04-07T18:19:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://mbwiki.stairwaygames.work/w/index.php?title=Module:Accordion&amp;diff=5671&amp;oldid=prev</id>
		<title>Admin coral island: Created page with &quot;local getArgs = require(&#039;Dev:Arguments&#039;).getArgs local p = {} function p.main(frame)     local args = getArgs(frame)     local types = {         text = &#039;text&#039;,         links = &#039;links&#039;,     }     local hasTypeMismatch = false     local accordionsType = types[args.type] or &#039;text&#039;     local wrapper = mw.html.create(&#039;div&#039;):addClass(&#039;accordions__wrapper&#039;):attr({         [&#039;data-accordions-type&#039;] = accordionsType,         [&#039;data-animation-duration&#039;] = tonumber(args[&#039;animation-d...&quot;</title>
		<link rel="alternate" type="text/html" href="https://mbwiki.stairwaygames.work/w/index.php?title=Module:Accordion&amp;diff=5671&amp;oldid=prev"/>
		<updated>2023-08-03T16:54:27Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local getArgs = require(&amp;#039;Dev:Arguments&amp;#039;).getArgs local p = {} function p.main(frame)     local args = getArgs(frame)     local types = {         text = &amp;#039;text&amp;#039;,         links = &amp;#039;links&amp;#039;,     }     local hasTypeMismatch = false     local accordionsType = types[args.type] or &amp;#039;text&amp;#039;     local wrapper = mw.html.create(&amp;#039;div&amp;#039;):addClass(&amp;#039;accordions__wrapper&amp;#039;):attr({         [&amp;#039;data-accordions-type&amp;#039;] = accordionsType,         [&amp;#039;data-animation-duration&amp;#039;] = tonumber(args[&amp;#039;animation-d...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local getArgs = require(&amp;#039;Dev:Arguments&amp;#039;).getArgs&lt;br /&gt;
local p = {}&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
    local args = getArgs(frame)&lt;br /&gt;
    local types = {&lt;br /&gt;
        text = &amp;#039;text&amp;#039;,&lt;br /&gt;
        links = &amp;#039;links&amp;#039;,&lt;br /&gt;
    }&lt;br /&gt;
    local hasTypeMismatch = false&lt;br /&gt;
    local accordionsType = types[args.type] or &amp;#039;text&amp;#039;&lt;br /&gt;
    local wrapper = mw.html.create(&amp;#039;div&amp;#039;):addClass(&amp;#039;accordions__wrapper&amp;#039;):attr({&lt;br /&gt;
        [&amp;#039;data-accordions-type&amp;#039;] = accordionsType,&lt;br /&gt;
        [&amp;#039;data-animation-duration&amp;#039;] = tonumber(args[&amp;#039;animation-duration&amp;#039;])&lt;br /&gt;
    })&lt;br /&gt;
    local accordions = {}&lt;br /&gt;
    local patterns = {&lt;br /&gt;
        &amp;#039;accordion%-(%d+)%-(title)&amp;#039;,&lt;br /&gt;
        &amp;#039;accordion%-(%d+)%-(contents)&amp;#039;,&lt;br /&gt;
        &amp;#039;accordion%-(%d+)%-(link)%-(%d+)&amp;#039;,&lt;br /&gt;
    }&lt;br /&gt;
    for k, v in pairs(args) do&lt;br /&gt;
        local index, thing, subIndex&lt;br /&gt;
        for _, pattern in ipairs(patterns) do&lt;br /&gt;
            index, thing, subIndex = k:match(pattern)&lt;br /&gt;
            if index then break end -- found the pattern&lt;br /&gt;
        end&lt;br /&gt;
        -- Ensure indices are numeric.&lt;br /&gt;
        index = tonumber(index)&lt;br /&gt;
        subIndex = tonumber(subIndex)&lt;br /&gt;
        if index then&lt;br /&gt;
            if (&lt;br /&gt;
                accordionsType == &amp;#039;links&amp;#039; and thing == &amp;#039;contents&amp;#039; or&lt;br /&gt;
                accordionsType == &amp;#039;text&amp;#039; and thing == &amp;#039;link&amp;#039;&lt;br /&gt;
            ) then&lt;br /&gt;
                hasTypeMismatch = true&lt;br /&gt;
            end&lt;br /&gt;
            accordions[index] = accordions[index] or {}&lt;br /&gt;
            if subIndex then&lt;br /&gt;
                accordions[index][thing] = accordions[index][thing] or {}&lt;br /&gt;
                accordions[index][thing][subIndex] = v&lt;br /&gt;
            else&lt;br /&gt;
                accordions[index][thing] = v&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    -- TODO: Maybe log the indices of accordions with mismatched type?&lt;br /&gt;
    if hasTypeMismatch then&lt;br /&gt;
        mw.log(&amp;#039;Warning: Accordion contains mixed types. Mismatched types will be ignored.&amp;#039;)&lt;br /&gt;
    end&lt;br /&gt;
    for i, v in ipairs(accordions) do&lt;br /&gt;
        local title = v.title&lt;br /&gt;
        local contents = v.contents&lt;br /&gt;
        local links = v.link&lt;br /&gt;
        -- BUG: Expanded argument doesn&amp;#039;t work.&lt;br /&gt;
        local expanded = v.expanded or &amp;#039;false&amp;#039;&lt;br /&gt;
        if title or contents or links then&lt;br /&gt;
            local accordion = wrapper:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
                :addClass(&amp;#039;accordion&amp;#039;)&lt;br /&gt;
            accordion:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
                :addClass(&amp;#039;accordion--header&amp;#039;)&lt;br /&gt;
                :attr(&amp;#039;data-aria-expanded&amp;#039;, expanded)&lt;br /&gt;
                :wikitext(title)&lt;br /&gt;
            local contentsDiv = accordion:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
                :addClass(&amp;#039;accordion--panel&amp;#039;)&lt;br /&gt;
            if accordionsType == &amp;#039;links&amp;#039; and links then&lt;br /&gt;
                contentsDiv:addClass(&amp;#039;accordion__links--panel&amp;#039;)&lt;br /&gt;
                local ul = contentsDiv:tag(&amp;#039;ul&amp;#039;)&lt;br /&gt;
                for _, link in ipairs(links) do&lt;br /&gt;
                    ul:tag(&amp;#039;li&amp;#039;)&lt;br /&gt;
                        :wikitext(link)&lt;br /&gt;
                end&lt;br /&gt;
            elseif accordionsType == &amp;#039;text&amp;#039; and contents then&lt;br /&gt;
                contentsDiv:wikitext(contents)&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return tostring(wrapper)&lt;br /&gt;
end&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Admin coral island</name></author>
	</entry>
</feed>