Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to create cloak in the trac wiki?

Tags:

wiki

trac

Is it possible to show and hide blocks of content in the trac wiki similar to the cloak macro of confluential?

like image 269
Vitali Avatar asked Feb 25 '23 20:02

Vitali


2 Answers

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.

like image 157
Gregoo Avatar answered Mar 10 '23 10:03

Gregoo


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.

like image 22
Remy Blank Avatar answered Mar 10 '23 10:03

Remy Blank