-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some links between markdown files point to non-existing pages #294
Comments
Hi @cmanique I've read the related (closed) issue CONFCLOUD-69902. The proposed solution is not easy to apply in such plugin because currently it generates the storage format using a confluence builtin conversion: Conversion pipeline
As you can see it is not possible apply the proposed solution because plugin control the generation pipeline until WIKI generation. I'll investigate if is possible make something from wiki format itself. WorkaroundAt the moment, the only workaround I see is to not use format Markdown/Wiki but to write the page directly in storage format, feature supported by this plugin Let me know your thoughts |
Hi @bsorrentino thanks for your quick reply. I really think this is a bug originating from maven-confluence-plugin/core/src/main/java/org/bsc/markdown/MarkdownVisitorHelper.java Lines 113 to 119 in e3810ee
which is called from Line 281 in e3810ee
There are no checks if the prefix is being applied more than once. Hence the wrong links once a Site.Page was already processed. I cloned the repo locally and did some tests with this quirky (changing inside the lambda would be a big departure from the current implementation) fix, that seems to mitigate the problem: String linkUrl = parseContext.getSite()
.flatMap( site -> site.getHome().findPage( comparePath ) )
.map( page -> parseContext.getPagePrefixToApply()
.filter( prefixToApply -> !url.startsWith(prefixToApply) )
.map( prefixToApply -> format( "%s - %s", prefixToApply, page.getName() ) )
.orElse( page.getName() ) )
.orElse(url);
String pagePrefixToApply = parseContext.getPagePrefixToApply().get();
if(linkUrl.startsWith(format("%s - %s - ",pagePrefixToApply,pagePrefixToApply))){
linkUrl = parseContext.getSite().flatMap( site -> site.getHome().findPage( comparePath)).map( p -> p.getName()).orElse(linkUrl);
}
return linkUrl; I'm sure it needs real testing to ensure it doesn't break anything else, but you think a bug fix with this direction would be possible? Thanks for the great support and all the work with the tool |
prepare for reproduce issue working #294
Hi @cmanique There is no need to change stream pipeline I've applied your suggestion and tested it with success without interrupt flow. return parseContext.getSite()
.flatMap( site -> site.getHome().findPage( comparePath ) )
.map( page -> parseContext.getPagePrefixToApply()
.map( prefixToApply -> prefixToApply.concat(" - "))
.filter( prefixToApply -> !url.startsWith(prefixToApply) ) // check prefix already applied
.filter( prefixToApply -> !page.getName().startsWith(prefixToApply) ) // check prefix already applied
.map( prefixToApply -> prefixToApply.concat( page.getName() ) )
.orElse( page.getName() ) )
.orElse(url)
; I've deployed developer release |
Hi @bsorrentino, Your code works if I build it locally, but with 7.13-SNAPSHOT from https://oss.sonatype.org/content/repositories/snapshots keeps the same behavior. The decompiled class from the snapshot jar doesn't seem to have those changes. |
it's weird🤔. I've redeployed |
Hi @bsorrentino , just ran with -U and got a new jar. |
I've planned to fix also #295 after that I'll release official 7.13 probably at end of this week |
Hi @cmanique release |
Thanks again for the awesome work and fast support @bsorrentino |
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
a.md
b.md
c.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:
Page-B storage format:
Page-C storage format:
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:
maven-confluence-plugin/processor-commonmark/src/main/java/org/bsc/markdown/commonmark/CommonmarkConfluenceWikiVisitor.java
Lines 279 to 290 in e3810ee
Maybe it needs a second pass to recheck destinations that were not yet present, or something of the sort.
The text was updated successfully, but these errors were encountered: