Can I create a cloak in a wiki?

Is it possible to display and hide content blocks in a wiki trac similar to a hidden merge macro ?

+4
source share
4 answers

It's been a few months, but I was wondering the same thing. Remy Blank's answer put me on the right track, it just lacked an extra div.

{{{#!div {{{#!html <h3 class="foldable">Section title</h3> }}} {{{#!div This is the section content. }}} }}} 

If you look at the stylesheet, it will show you which element will be hidden with the collapsed style.

 .collapsed > div, .collapsed > table, .collapsed > ul, .collapsed > dl { display: none } 

The Remy code was a wrap "This is the contents of the section" inside the p markup, so it was not hidden.

+5
source

If you just want to (temporarily) hide some content while storing it in the page source, you can use the wiki processor {{{#comment}}} . As bta mentioned, content is still available when loading the page source, so this is not a security measure.

If you want to collapse the 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 display the section title with a small triangle to the left, and clicking on the title will switch the section between collapsed and expanded. The section will be collapsed first.

+1
source

I'm very late to the party, but FoldMacroProcessorMacro allows you to do this without resorting to HTML.

+1
source

There are no permissions for this fine grain in current versions of Trac. User accounts may be granted access to the wiki, but this is an all-or-nothing setting. The raw version of the wiki version of the wiki page can be downloaded in text format using the links at the bottom of the wiki page, so this macro will not limit the content.

You can write an add-in that blocks access to a specific wiki page based on the user account name or permissions, but which is still at the page level, and not at the block level, like the macro mentioned.

0
source

Source: https://habr.com/ru/post/1343260/


All Articles