Is it possible to create cloak in the trac wiki?
Is it possible to show and h开发者_StackOverflow中文版ide 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.
I'm super late to the party, but the FoldMacroProcessorMacro lets you do this without resorting to HTML.
The current versions of Trac do not have permissions this fine-grained. User accounts can be granted wiki access, but it's an all-or-nothing setting. The raw wiki-format version of a wiki page can be downloaded in plain text using the links at the bottom of the wiki page, so a macro like this wouldn't really restrict content.
It's possible to write an add-on that blocks access to a particular wiki page based on user account name or permissions, but that's still page-level granularity and not block-level like the macro you mentioned.
精彩评论