Usage of macro 'toc' combined with user macro on same page leads to parsing error, when user macro body contains header lines

Joachim Simon January 31, 2013

With the following user macro the rendering of the page leads to the exception:

Fehler beim Rendern des Makros 'toc': com.ctc.wstx.exc.WstxLazyException com.ctc.wstx.exc.WstxParsingException: Duplicate attribute 'id'. at row,col {unknown-source} : 2,52

User macro:

## Macro title: My Macro

## Macro has a body: Y or N

## Body processing: Selected body processing option

## Output: Selected output option

##

## Developed by: My Name

## Date created: dd/mm/yyyy

## Installed by: My Name

## This is an example macro

## @noparams

$body

page content:

<ac:macro ac:name="toc"/>

Heading 1

<ac:macro ac:name="write-through"><ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter><ac:rich-text-body>

Heading 2

</ac:rich-text-body></ac:macro>

1 answer

0 votes
hsuhailah
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.
January 31, 2013

Looks like you're hitting a known bug of TOC as tracked here: https://studio.plugins.atlassian.com/browse/TOC-127 & https://jira.atlassian.com/browse/CONF-25584

There's no available workaround at the moment I'm afraid. Please watch the bug report for future notification byt he development team.

Joachim Simon February 6, 2013

Is it possible, that the rendering process is causing this problem, as it is performed twice? Once within the macro, a second time fro the entire page. Each time an 'id' attribute is added to the <h1> tag. The 'toc' then, using the standard XML parser runs into this error.

Maybe just changing the rendering process in a way, that it only adds an attribute, if it's not already there.

The other possible solution I can imagine, is to change the implementation of the 'toc' macro.

Anyway, what is the development team's plan for solving this?

BTW TOC-127 seems to be representing my problem exactly, but as <span>studio.plugins.atlassian.com will be decommissioned in early 2013, I won't be able to follow this one. CONF-25584 ist not exactly the thing, so where should I look for a solution then?

Suggest an answer

Log in or Sign up to answer