-
-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Hello,
Running version 7.12 of plugin with Java 8 or 17, against confluence server 7.x.
Please find below the steps to try and reproduce links being generated to non-existing pages.
site.yaml
home:
uri: home.md
children:
- name: Page-A
uri: a.md
children:
- name: Page-B
uri: b.md
- name: Page-C
uri: c.md
a.md
# Page A
- [This is Page-B Link](b.md)
- [This is Page-C Link](c.md)
b.md
# Page B
- [This is Page-A Link](a.md)
- [This is Page-C Link](c.md)
c.md
# Page C
- [This is Page-A Link](a.md)
- [This is Page-B Link](b.md)
The page structure is correctly published to confluence:
However some of the links are not correctly generated, as you can see on the storage format for each of the pages:
Page-A storage format:
<h1>Page A</h1>
<ul>
<li>
<ac:link>
<ri:page ri:content-title="TCAAS3218-466 - Page-B"/>
<ac:link-body>This is Page-B Link</ac:link-body>
</ac:link>
</li>
<li>
<ac:link>
<ri:page ri:content-title="TCAAS3218-466 - Page-C"/>
<ac:link-body>This is Page-C Link</ac:link-body>
</ac:link>
</li>
</ul>
Page-B storage format:
<h1>Page B</h1>
<ul>
<li>
<ac:link>
<ri:page ri:content-title="TCAAS3218-466 - TCAAS3218-466 - Page-A"/>
<ac:link-body>This is Page-A Link</ac:link-body>
</ac:link>
</li>
<li>
<ac:link>
<ri:page ri:content-title="TCAAS3218-466 - Page-C"/>
<ac:link-body>This is Page-C Link</ac:link-body>
</ac:link>
</li>
</ul>
Page-C storage format:
<h1>Page C</h1>
<ul>
<li>
<ac:link>
<ri:page ri:content-title="TCAAS3218-466 - TCAAS3218-466 - Page-A"/>
<ac:link-body>This is Page-A Link</ac:link-body>
</ac:link>
</li>
<li>
<ac:link>
<ri:page ri:content-title="TCAAS3218-466 - TCAAS3218-466 - Page-B"/>
<ac:link-body>This is Page-B Link</ac:link-body>
</ac:link>
</li>
</ul>
It seems like the pages are being processed/created in ascending order, and the only links that are broken are the ones for pages that didn’t exist at the time (they have an extra TCAAS3218-466).
TCAAS3218-466 in this case is the value of the pageTitle parameter (didn’t try this with the default that uses maven cords, but I’d naifly argue it’s not related).
By glancing at the repo I'm tempted to say the code below is the likely culprit:
Lines 279 to 290 in e3810ee
public void visit(Link node) { | |
final String destination = processLinkUrl(node.getDestination(), parseContext); | |
processChildren(node) | |
//.preAndPost("<<LNK>>") | |
.pre(() -> "[" ) | |
.captureOutput( v -> buffer().append(v) ) // ignore text | |
.post(() -> format("|%s%s]", destination, ofNullable(node.getTitle()).map( v -> "|"+v ).orElse("")) ) | |
.process() | |
.nl(isParentRoot(node)); | |
} |
Maybe it needs a second pass to recheck destinations that were not yet present, or something of the sort.