Colalt - Multiple Collapsibles

By RTa_subRTa_sub

Description

Speaking of multiple collapsibles, there's Boyu12Boyu12's colmod.
I wanted to make a similar one, so I used the collapsible-block code to create multiple collapsibles.
The sooner you see it in action first, the better.

Demo1

Colalt is colalt itself…

Syntax

And the source code is different in the odd and even layers.
You must be wondering what are odd and even layers?

The first layer of colalt is the first layer, and when you nest the colalt in order, the second layer, the third layer, and so on.
In this case, the odd or even number of n in the n layer is determined by whether the n are odd layer or even layer.

Item name Data type Initial value Description
oddtop [ null(none) Add [ as described above.
oddend [ null(none) Add [ as described above.
eventop [ null(none) Add [ as described above.
evenend [ null(none) Add [ as described above.
show String + show block Open link text.
hide String - hide block Close link text.
nohide true,false false true will not display the close link.
folded true,false true false leaves it open and can be collapsed by the user at will.
In this case, add f at the beginning of oddtop, eventop, oddend, and evenend.
oddtop → foddtop
eventop → feventop
oddend → foddend
evenend → fevenend
This is a See Demo 4 for more information.

Code

You can add/modify parameters as needed by enclosing the part you want to fold with the following colalt.

[[include :snippets:colalt |oddtop=[|show=+open|hide=-close]]

[[include :snippets:colalt |eventop=[|show=+open|hide=-close]]

[[include :snippets:colalt |evenend=[|show=+open|hide=-close|nohide=true]]
[[include :snippets:colalt |oddend=[|nohide=true]]

In action

Demo 2

If you omit nohide in oddend or evenend and set hide

Demo 3

If you omit hide in oddtop or eventop and set nohide=true

Demo 4

If you set folded=false

- close

You can reproduce the collapsible folded="no".
You need to convert it to
oddtop → foddtop
eventop → feventop
oddend → foddend
evenend → fevenend .

[[include :snippets:colalt |foddtop=[|folded=false|nohide=true|hide=- close]]
You can reproduce the collapsible folded="no".
[[include :snippets:colalt |foddend=[|folded=false|show=+ open|nohide=true]]

Demo 5

If you enclose a colalt with [[div class="collapsiblealt"]] and [[/div]]…

Demo6

Important

Cannot be used within [[iftags]].

Cannot be used within [[collapsible]].

Skipping and closing odd numbers causes clutching.


Thanks to tsangk for this great snippet: conditional-blocks


text above inserted with:

[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]



Other snippets posted by RTa_sub

Fake tags with links - 19 Sep 2020 07:38


Rate this solution

If you think this solution is useful — rate it up!

rating: +6+x
Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License