How to use #documentTree with multiple exclusions?

I know that generally, multiple exclusions with the documentTree macro work like this:

{{documentTree exclusions="document:mywiki:Panels.WebHome,document:mywiki:Sandbox.WebHome" /}}

However, I need to use the Velocity macro #documentTree (based on {{template name="documentTree_macros.vm"/}} in the first line) because there are other commands in the script which the standalone macro does not allow. Hence I would need the ‘value’ : ‘parameter’ syntax.

But this does not work, the exclusions are ignored:

#documentTree({
  'exclusions' : 'document:mywiki:Panels.WebHome,document:mywiki:Sandbox.WebHome'
})

It works, at least for me, only with one exclusion. But not more than one.

How to do that? I’m trying for hours already in any syntax I can think of.

If you check the code of the Document Tree macro you’ll notice that it calls #prepareTreeOptions($options) just before calling #documentTree($options).

prepareTreeOptions splits the exclusions string by comma and creates a Java Set. You need to do the same, using $collectiontool.set.

Hope this helps,
Marius

Thanks! I’ll check that out. Maybe the extension page deserves this remark as well, as right now it somehow reads as if the parameters are treated just the same in the Wiki and the Velocity macro.

I added a bit more information. I hope it helps.

1 Like