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

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

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

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.

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
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,531 views 15 21
Read article

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