Is it possible to show and hide blocks of content in the trac wiki similar to the cloak macro of confluential?
It's a few month old but I was wondering the same thing. Remy Blank answer put me on the right track, he was just missing an extra div.
{{{#!div
{{{#!html
<h3 class="foldable">Section title</h3>
}}}
{{{#!div
This is the section content.
}}}
}}}
If you look at the style sheet, it shows you which element gets hidden with the collapsed style.
.collapsed > div, .collapsed > table, .collapsed > ul, .collapsed > dl { display: none }
Remy's code was wrapping "This is the section content" inside a p markup, that's why it wasn't hidden.
If you just want to (temporarily) hide some content while keeping it in the page source, you can use the {{{#comment}}}
wiki processor. As mentioned by bta, the content is still accessible by downloading the page source, so this is not a security measure.
If you want to collapse a section, and allow users to expand it by clicking, you can use the following trick (tested with 0.12):
{{{#!div class=""
{{{#!html
<h3 class="foldable">Section title</h3>
}}}
This is the section content.
}}}
This will show the section title with a small triangle on its left, and clicking the title will toggle the section between collapsed and expanded. The section will initially be collapsed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With