Scaffolding and TOC

Gabriel Sejournant August 23, 2011

Hello,

I'm using Scaffolding with textareas for headers.

The Toc macro show the titles but in the area of scaffolding even in the view mode.

Is their a way to have a table of anchor in the page using scaffolding ?

(my question is close from : https://answers.atlassian.com/questions/1974/scaffolding-and-toc)

2 answers

0 votes
David Peterson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 25, 2011

Yeah, I see what you're saying now - the text box shows up in the TOC. My guess is that TOC has changed the way it is generating itself recently and we hadn't noticed. Either that, or Confluence itself has changed the way that it sends events.

Essentially, the TOC caches the actual headings when you save it so that it doesn't have to recalculate it every time you view the page. However, for whatever reason, Scaffolding thinks it is still in 'edit' mode when getting rendered for this purpose, and as such, the edit box shows up.

This will require a bug fix, so my suggestion is to create a bug report and I'll schedule it for investigation. In the meantime, there is a workaround. You need to force TOC to refresh itself after you save the Scaffolding page. The way to do this is to add '?refresh=true' to the URL for the page when in view mode. Eg:

http://yourserver/confluence/display/SPACEKEY/My+Page?refresh=true

It only needs to be done once after saving. Not ideal, but it may work in the interim.

Regards,

David Peterson

Gabriel Sejournant August 25, 2011

Thank's a lot David, I created the issue :

https://greenhouse.customware.net/jira/browse/SCAFF-468

I didn't vote for it but I hope you will find time to investigate and maybe correct it.

Thank's for the tip but I'm not yhe only one user, I will keep it for me.

0 votes
David Peterson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 24, 2011

Hi Gabi,

This stems from a bug in Confluence itself, where it will not produce useful anchor tags automatically for headers that contain macro markup. You'll get a similar result if you try doing something like 'h1. {color:read}A red header!{color}'.

The workaround is to generate an anchor tag for each header, and the {toc} macro will use that anchor instead. Eg:

h1. {text-data:Heading} {anchor:my heading}

This will give TOC something to work with. However, if you're in a {repeating-data} section or something like that which is dynamically generated, you obviously don't want a static anchor. The workaround here is to generate a dymamic one, most easily with the Reporting Plugin. Eg:

h1. {text-data:Heading} {report-on:injected=true}{anchor:%data:Heading%}{report-on}

This will output the heading, then output an anchor tag based on that heading.

Hope that helps!

Regards,

David Peterson

Gabriel Sejournant August 24, 2011

Hello,

Than's a lot for your answer but for the moment it doesn't seems to work, maybe I don't understand enough, so i'm wirtting you an example :

My wiki markup was :

{Toc}

{repeating-data:blocone|initialRows=1}

{panel:title=|borderStyle=solid|borderColor=red|borderWidth=1}

h2. {text-data:titlebloc|type=line|width=600px}Title{text-data}
{text-data:resume|type=area|width=600px|height=300px}Resume{text-data}

{panel}

{repeating-data}

{repeating-data:paragraph|initialRows=1}

h2. {text-data:prgph|type=line|width=600px}Text{text-data

{repeating-data}

I tried this markup was :

{Toc}

{repeating-data:blocone|initialRows=1}

{panel:title=|borderStyle=solid|borderColor=red|borderWidth=1}

h2. {text-data:titlebloc|type=line|width=600px}Title{text-data}
{text-data:resume|type=area|width=600px|height=300px}Resume{text-data}{report-on:injected=true}{anchor:%data:Heading%}{report-on}

{panel}

{repeating-data}

{repeating-data:paragraph|initialRows=1}

h2. {text-data:prgph|type=line|width=600px}Text{text-data}{report-on:injected=true}{anchor:%data:Heading%}{report-on}

{repeating-data}

But I still have the same problems : The "Toc" is still editable even un the view mode and the all title are twice.

Is it a bug of confluence / a macro / my wikimarkup ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events