Using TOC and reporter macro. Generating anchors.

I tried to use TOC for page with content (haedings) generated with reporter macro. It doesn't work. Probably beacause of that, there are no anchors generated. Is there a way to generate them automaticly?

I tried something like this, but it doesn't work.

{composition-setup}
{composition-setup}
{section}
{column:width=15%}
{toc:maxLevel=3}
{column}
{column:width=85%}
{table:border=1|cellpadding=10px|cellspacing=3px|width=100%} 
{report-block}
{local-reporter:value:label IB7 > label:content|space=MARINEIMAGES }
{text-sort:content:title}
{content-filter:space=MARINEIMAGES |labels= +marine, +spec_cases, +ib}
{local-reporter}
{report-body}
{tr}{td}
h3.{report-on:injected=true}{anchor:%content:title%}{report-on}
h3.{report-info:content:title|link=false}
{report-info:content:body|render=wiki}{td}{tr}
{report-body}
{report-empty}None.{report-empty}
{report-block}
{table}
{column}
{section}

1 answer

I solve the problem by creating two user macros:
m_anchor - {anchor:$body}
m_callanchor - [#$body]
both generate wiki markup. The whole solution is listed below.

{anchor:TOC}
{panel:title=TOC|titleBGColor=#00CCFF}
{report-block}
{local-reporter:value:label IB7 > label:content}
{text-sort:content:title}
{content-filter:space=MARINEIMAGES |labels= +marine, +spec_cases, +ib}
{local-reporter}
{report-body}
* {m_callanchor}{report-info:content:title|link=false}{m_callanchor}
{report-body}
{report-empty}None.{report-empty}
{report-block}
{panel}

{table:border=1|cellpadding=10px|cellspacing=3px|width=100%}
{report-block}
{local-reporter:value:label IB7 > label:content}
{text-sort:content:title}
{content-filter:space=MARINEIMAGES |labels= +marine, +spec_cases, +ib}
{local-reporter}

{report-body}
{tr}{td}
{m_anchor}{report-info:content:title|link=false}{m_anchor}
h3.{report-info:content:title|link=false}
{report-info:content:body|render=wiki}
[Go back to TOC|#TOC]{td}{tr}
{report-body}
{report-empty}None.{report-empty}
{report-block}
{table}

As you can see, I search twice for the same thing:

{local-reporter:value:label IB7 > label:content}

First, when I create TOC, second for the content. The question is how to do it just once?

I did something like this, it works, but it's not elegant:

{anchor:TOC}{table:border=1|cellpadding=10px|cellspacing=3px|width=100%}
{report-block}
{local-reporter:value:label IB7 > label:content}
{text-sort:content:title}
{content-filter:space=MARINEIMAGES |labels= +marine, +spec_cases, +ib}
{local-reporter}

{report-body}
* {m_callanchor}{report-info:content:title|link=false}{m_callanchor}
{tr}{td}
{m_anchor}{report-info:content:title|link=false}{m_anchor}
h3.{report-info:content:title|link=false}
{report-info:content:body|render=wiki}
[Go back to TOC|#TOC]{td}{tr}
{report-body}
{report-empty}None.{report-empty}
{report-block}
{table}

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

986 views 51 8
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you