This issue has been created
There is 1 comment.
 
 
XWiki Rendering / cid:jira-generated-image-avatar-08b8a6ba-bcda-4049-b27b-943d88f9677e XRENDERING-802 Open

Prepared macro content leads to duplicated IDs when inserted

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-808c316e-ab27-467a-85a5-f41465050301 Marius Dumitru Florea created this issue on 22/Jan/26 21:56
 
Summary: Prepared macro content leads to duplicated IDs when inserted
Issue Type: cid:jira-generated-image-avatar-08b8a6ba-bcda-4049-b27b-943d88f9677e Bug
Affects Versions: 17.10.2
Assignee: Unassigned
Components: Transformation
Created: 22/Jan/26 21:56
Priority: cid:jira-generated-image-static-major-a8d806a7-9532-4d2b-9beb-5a33620e8ac6 Major
Reporter: Marius Dumitru Florea
Description:

Follow these steps to reproduce:

  • Create a page with this content:
    = Heading =
    
    = Heading =
    
  • Create a second page with this content:
    = Heading =
    
    {{info}}
    = Heading =
    {{/info}}
    
  • Create a third page that displays the first two:
    {{display reference="First.Page" /}}
    
    {{display reference="Second.Page" /}}
    
  • Check the heading IDs in the rendered HTML

Expected: the heading IDs should be all unique: HHeading, HHeading-1, HHeading-2, HHeading-3
Actual: we get duplicated section IDs: HHeading, HHeading-1, HHeading-2, HHeading-1

The problem doesn't reproduce if we replace the info macro with the velocity macro. This shows that the problem is with macros that support wiki content. The content of these macros is prepared (cached XDOM). The heading from the prepared content gets a generated ID HHeading-1 that is unique in the scope of the second document. But when this prepared content is inserted in the content aggregated from both documents, the ID is not "fixed" (like we do in DocumentContentAsyncExecutor) so it duplicates existing IDs.

 
 

1 comment

 
cid:jira-generated-image-avatar-808c316e-ab27-467a-85a5-f41465050301 Marius Dumitru Florea on 22/Jan/26 22:04
 

It seems we need to fix the IDs after the prepared content is cloned in DefaultMacroContentParser, before it gets inserted. But we need to extract the code from DocumentContentAsyncExecutor that does the same, in a common place, to be reused.