Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Using TOC and reporter macro. Generating anchors.

Michal Zebrowski March 21, 2012

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

0 votes
Michal Zebrowski March 29, 2012

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
TAGS
AUG Leaders

Atlassian Community Events