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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,792 views 26 10
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