Hi,
I want to use the Table of Contents (TOC) macro in the sidebar. I want to exclude all headings that end in "headingABC" and all headings that end in "headingDEF".
Key Items of Note :
- Wiki markup for macros use the pipe key to separate parameter/value pairs.
- Regex uses the pipe key as the OR operator within an expression.
Issue :
When I add an OR operator (pipe key) to the exclude parameter value it is effectively being interpreted as the end of the exclude parameter value rather than being interpreted as the OR operator within the expression value of the exclude parameter.
STRs
1. Create a page, add text for "headingABC" and "headingDEF" then set both to H1 (level is irrelevant). Click update to save the page.
2. Navigate to the space sidebar textarea (space tools > look and feel > sidebar, header, and footer) and copy/past the TOC markup {toc:exclude=.*headingABC|.*headingDEF} in the textarea and click save to save the sidebar.
3. Load the page created in step 1 and view the content rendered by the TOC macro.
//end STRs
Actual Result : Only the first heading added in the exclude is actually excluded.
Expected Result : All the headings specified in the exclude parameter should be excluded.
I have tried some variations including escaping the pipe {toc:exclude=.*headingABC\|.*headingDEF}, double escapes, double pipes, double rainbows, quotes in various places, and more but haven't yet gotten multiple expressions using the OR operator to exclude multiple headings in the sidebar. Works as expected when the TOC is in the page rather than the sidebar, however.
What's the markup that would accomplish this?
Thanks,
Nicole
I cannot seem to find away around the pipe issue. But what about if you rewrite the expression to this ...
{toc:exclude=.*heading(ABC)?(DEF)?}
Thank you for the prompt reply! That does exclude those headings however the example I provided was oversimplified. The heading titles I want to pass in won't have a partial string match in common (the 'Heading' prefix). I need to pass multiple disparate strings. For example, I want to exclude (The list is likely to grow.) :
pen
banana
fred
sky
blanket
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Would this work then?
{toc:exclude=.*(pen)?(banana)?(fred)?(sky)?(blanket)?(etc)?}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It does work but it's too robust. We are going to go with this for more precision :
{toc:exclude=^(pen)?(banana)?(fred)?(sky)?(blanket)?(etc)?$}
Thanks again!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Like the saying goes ...
"You have a problem and you want to solve it using Regular Expressions. Now you have two problems."
: )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.